Tired of Traffic!Easy

Tired of Traffic!

Easy+10 XP · +5 Aurabasicsloopsconditionals

Rohan is a student at UptoSkills Arena, and he's frustrated with the terrible traffic in his city. He wants to find the minimum number of distinct routes he needs to take to visit all his friends' houses. Each friend's house is located at a specific point on a single straight road. Rohan starts at his home, which is at coordinate 0. He can only travel in one direction (positive or negative) at a time. If he visits a friend at coordinate x, he can cover any friend located between his current position and x. He wants to minimize the number of trips he needs to make. A trip ends when he reaches a friend's house and decides to return home to start a new trip.

Input

The first line contains an integer N, the number of Rohan's friends. The next N lines each contain a single integer, the coordinate of a friend's house.

Output

Print a single integer: the minimum number of trips Rohan needs to make.

Constraints

1 <= N <= 1000 -1000 <= coordinate <= 1000 Coordinates are distinct.

Time limit 1 s (native code; slower languages get more)Memory 256 MB14 hidden tests

Example 1

Input
5
10
20
5
-10
-15
Output
2

Two trips needed: one for positive houses (e.g., to 20) and one for negative houses (e.g., to -15).

Example 2

Input
3
100
200
50
Output
1

Only one trip is needed to cover all positive houses (e.g., to 200).

Hints