Little Jessica received a set of building blocks for her birthday. The blocks are all cubes of the same size, and each block has a positive integer written on it. Delighted with the gift, she immediately stacked every block into one tall tower.
Her mother explained the game: reshape the tower so that as many blocks as possible sit in their proper place. A block with the number i written on it is in its proper place when it rests at altitude i. The bottom block is at altitude 1, the block above it at altitude 2, and so on.
Jessica may carefully remove some of the blocks. Whenever a block is removed, every block above it slides down by one, and the altitudes are renumbered from the bottom. She wants to remove blocks so that the number of blocks left in their proper place is as large as possible.
Given the tower Jessica first built, determine the largest number of blocks that can end up in their proper place.
The first line contains a single integer n (1≤n≤100000), the initial height of the tower. The second line contains n positive integers a1,a2,…,an (1≤ai≤1000000), separated by single spaces, where ai is the number written on the block at altitude i in the initial tower, listed from the lowest block to the highest.
Print a single integer: the maximum number of blocks that can be in their proper place after Jessica removes some blocks.

