Tower of Books


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C++, Java, Python

The Library of Babel is a short story by Jorge Luis Borges that imagines a library containing all possible 410-page books in the entire universe. The name is derived from the Tower of Babel, a biblical story where people tried to build a tower that would reach the sky. This gives you an idea.

While you can't build a tower to reach the sky, you could still try to make a tall tower out of books. You head over to the library and find long shelves filled with books. You logically conclude that it is best not to put larger books on top of smaller books, so whenever a larger book is encountered, you'll remove all the smaller books beneath it and continue going through the books on the shelves. There isn't much time before the library closes, so you get no time to sort through the books — you'll have to start stacking now!

Input

The first line contains an integer n\ (1 \leq n \leq 100), the number of books on the shelves.

The next n lines contain the size of the books s\ (1 \leq s \leq 10^3). The books are in the order in which you pick them up to use.

Output

Output the final height of your book tower, which is measured by the number of books in the tower.

Example

Input 1
5
50
30
40
20
10
Output 1
4

We put the book with size 50 at the bottom, then the book with size 30. However, since the next book which has a size of 40 is larger than 30, we remove the book with size 30. We can add the rest of the books without them being larger than the books underneath it. This results in a book tower of height 4.

Input 2
4
100
101
102
103
Output 2
1

The last book that you grab (which has a size of 103) is larger than the previous books you've grabbed. This means that the tower only has one book.


Comments

There are no comments at the moment.