Eliminating Ballons

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

An enourmous number of balloons are floating about in the Convention Hall after the Awarding Ceremony of the ICPC Subregional Contest. The manager of the Convention Hall is angry, because he will host another event tomorrow and the ballons must be removed. Fortunately this year Carlinhos came prepared with his bow and arrows to pop the balloons.

Also, luckily, due to the air conditioning flow, the balloons are all in the same vertical plane (that is, a plane parallel to a wall), although in distinct heights and positions.

Carlinhos will shoot from the left side of the convention hall, at a chosen height, in the direction of the right side of the Convention Hall. Each arrow moves from left to right, at the height it was shot, in the same vertical plane of the baloons. When an arrow touches a balloon, the baloon pops and the arrow continues its movement to the right, at a height decreased by 11. In other words, if the arrow was at height HH, after popping a balloon it continues at height H1H - 1.

Carlinhos wants to pop all balloons shooting as few arrows as possible. Can you help him?

입력

The first line of input contains an integer NN, the number of balloons (1N5×1051 ≤ N ≤ 5 × 10^5). Since all balloons are in the same vertical plane, lets define that the height of a ballon is given in relation to the yy-axis and the position of a balloon is given in relation to the xx-axis. Balloons are numbered from 11 to NN. Balloon numbers indicate their positions, from leftmost (balloon number 11) to rightmost (balloon number NN), independent of their heights. The position of balloon number i is different from the position of balloon number i+1i + 1, for all ii. The second line contains NN integers H_iH\_i, where H_iH\_i indicates the height of balloon number ii (1H_i1061 ≤ H\_i ≤ 10^6 for 1iN1 ≤ i ≤ N).

출력

Your program must output a single line, containing a single integer, the minimum number of arrows that Carlinhos needs to shoot to pop all balloons.