#P2866. [USACO06NOV] Bad Hair Day S
[USACO06NOV] Bad Hair Day S
Description
Farmer John has cows on a Bad Hair Day.
All cows stand in a single line facing right, and they are numbered from left to right as . Cow is at the front, and cow is at the back. The height of cow is .
For the cows in front of cow , if , then cow is considered able to see cows through .
Define as the number of cows visible to cow . Please help Farmer John compute .
Input Format
The input contains lines.
The first line contains an integer , the number of cows.
The next lines each contain an integer , representing the heights of cows .
Output Format
Output a single line with one integer, the value of .
6
10
3
7
4
12
2
5
Hint
Constraints
For of the testdata, it is guaranteed that , .
Translated by ChatGPT 5
京公网安备 11011102002149号