You are on page 1of 1

Task: Line of people

There are n people in line in front of the ticket counter for a football match. The heights
of the persons are known who are standing in line, from the first to the last person in
line. Write a program that determines how much a person from the line, the clerk at the
counter can see, if he sees those people in the line in front of whom they are lower
persons.
Input: The first line of the standard input contains a natural number n (5 ≤ n ≤ 50000)
representing the number of persons which are in line. Each of the next n lines contains
one natural number, these numbers represent heights in order from the first to the last
person in line (heights can be expressed in arbitrary units of measure, so they can be
numbers between 10 and 105).
Output: In one line of the standard output, display the number of people in the queue
that the officer can see.
EXAMPLE
Input: Output:
8 3
165
178
170
178
183
176
168
183

You might also like