Luca has recently stepped up his training with the ultimate goal of being able to run a half marathon: as soon as he can, he goes out for a run. Since he always wears a fitness tracker, every time he trains the covered distance is automatically recorded in his favourite fitness application. So far, the details of training sessions have been captured. Among other information, one can see that in the -th session he ran for kilometres.
Luca wants to analyse the progress to check whether he is getting better. Specifically, he would like to know how big is his longest improving streak. A sequence of consecutive training sessions, starting from the -th one and ending at the -th one, is an improving streak if Luca has run at least as many kilometres in the last session as in the first one and if he has covered at least and at most kilometres in every one of them (formally, for each ).
How long is the longest improving streak Luca has recorded?
Input data
The first line contains the only integer , the number of training sessions recorded by Luca. The second line contains integers , the distance covered in the -th training session.
Output data
You need to write a single line with an integer: the length of the longest improving streak of training sessions.
Constraints and clarifications
- ;
- ;
# | Score | Constraints |
---|---|---|
1 | 0 | Examples |
2 | 17 | for each |
3 | 20 | |
4 | 26 | |
5 | 37 | No additional limitations. |
Example 1
stdin
5
2 1 3 5 10
stdout
4
Explanation
In the first sample case, there is one improving streak of length four, consisting of the last four training sessions. In each of those four sessions Luca has run at least and at most kilometres. No longer improving streaks exist.
Example 2
stdin
6
2 7 3 8 4 7
stdout
4
Explanation
In the second sample case, there is one improving streak of length four, composed of the first four training sessions. In the first four sessions, Luca has always run at least and at most kilometres. No longer improving streaks exist.