Problem

13 /21


line

Theory Click to read/hide

Reading an unknown number of data

To read an unknown number of data in C++, use the following loop: while(cin >> a) { // work with number a } This write method reads all the data up to the end of the file. 

In Python, you can read all the data from one line into an array at once. A = list(map(int, input().split()))

Problem

Petya moved to another school. In a physical education lesson, children are built according to their height, starting with the tallest. Write a program that will help Petya determine his place in the ranks.

Input
The program receives as input a non-increasing sequence of natural numbers, meaning the growth of each student in the ranks. After that, the number x – Petya's growth. All numbers in the input are natural and do not exceed 200.

Imprint
Print the number under which Petya should join the ranks. If there are people in the ranks with the same height, the same as Petya, then he should stand after them.
 
Examples
# Input Output
1 165 163 160 160 157 157 155 154 
162
3
2 165 163 160 160 157 157 155 154 
160
5
 
Note
To read data in C++, use a loop while(cin >> a) { // work with number a } Please note that in C++ this way of reading reads all the data from the input stream at once, including the last line.

You can read data in Python directly into an array A = list(map(int, input().split()))