1248 - Frog's insects

Time Limit : 1 Second

Memory Limit : 128 MB

Submission: 208

Solved: 55

A frog is going to starve to death when God give it some insects. The insects are put inside a line of N plates, and one insect in one plate. At the beginning, the frog can jump into any plate. Then the frog can only jump forward into larger plates. The frog will eat up all food in a plate when it jumps into it. Please help the greedy frog eat as many insects as possible.
Note that the frog can only jump forward .
There are multiple cases ended with EOF. Every case have two lines .
The first number of each case is one number——N (3 <= N <= 100000).
The following N positive integers si (1 <= si <= 1000000000) are the size of N plates.
For each test, output one line containing a single integer——maximum insects the frog can eat.
sample input
1 3 5 7 9
10 8 6 4 2
sample output
© 2015 HUST ACMICPC TEAM. All Right Reserved.