Solved by 292 users: ...
` <  <  <  <  <  <  <  <  <  < `

## Pancake-week

Time limit = 2 second(s)

Petya has many friends. Today they visit him to eat his delicious pancakes (Petya has a talent for pancake-making). Petya put N frying pans one by one and cooked pancakes on each of them. Now he wants to serve up the pancakes for dinner. Petya can advance from first frying pan to second,from second to third ,..., from N-1 to N. Pancakes has different sizes, unfortunately, and Petya doesn't want to put them at a plate randomly. Viz. he wants to put them in a "hill-like" way: pancake K+1 must be smaller than pancake K. Obviously, Petya can hardly put all the pancakes in one pass. Your aim — to help him and find out the minimum number of passes, he can put all the pancakes.

Input First enter string contains number of the frying pans N (1 ≤ N ≤ 10000). Then follow N integers — radii of the pancakes R (0 ≤ R ≤ 65535).

Output Minimum number of the passes.

 Input#1```3 1 1 1 ``` Output#1```3 ```
 Input#2```5 5 4 3 2 1 ``` Output#2```1 ```
 Input#3```19 7 19 32 15 71 94 33 4 26 11 89 75 16 31 54 95 27 2 14 ``` Output#3```6 ```

Author:
Classical task. Text and tests by Sergey Kuznetsov.

 © acm.mipt DevGroupThe page was generated in 180ms