- 90

## Statement

## Goal

Count the**number of lines**needed to draw the skyline of a city.

The city skyline (or silhouette) as seen from a distance consists of a series of buildings with rectangular shape which might overlap each other.

Each building is described by its height (

`h`) above ground level and the horizontal position of the left (

`x1`) and right (

`x2`) walls.

**Line drawing rules:**

To draw the skyline of a city with a single building

____

| |

| |

| |

Two separate buildings can be drawn using

____

| | ______

| | | |

| |_____| |

Two partially overlapping or adjacent buildings of different heights require

The dotted lines in the picture below show the actual shape of the two buildings.

____

| |____

| ¦¨¦ |

| ¦ ¦ |

Two buildings are called adjacent (i.e. touching each other) if their opposing walls have the same horizontal position.

Input

**Line 1:**An integer

`n`for the number of buildings in the city.

**Next**Three space separated integers

`n`lines:`h`,

`x1`and

`x2`for the height and the two positions of the walls respectively.

The buildings are given in no particular order.

Output

One line containing the number of lines needed to draw the city skyline.

Constraints

1 ≤

1 ≤

0 ≤

`n`≤ 1001 ≤

`h`≤ 2000 ≤

`x1`<`x2`≤ 5000Example

Input

1 10 100 110

Output

3

A higher resolution is required to access the IDE

Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!

JOIN US ON DISCORD Online Participants