Module: (Python) The for loop statement. Typical tasks


Problem

9 /16


The maximum number in the sequence

Theory Click to read/hide

When studying the conditional operator, we touched on the topic of finding the maximum number from several entered numbers. In the "Maximum of four numbers" problem, we used the following algorithm:
1. Assign the value of the variable Max to the first of four variables
2. If the value of the second variable is greater than the value in the maximum variable, then replace the value of the maximum variable with the value of the second variable
3. If the value of the third variable is greater than the value in the maximum variable, then replace the value of the maximum variable with the value of the third variable
4. If the value of the fourth variable is greater than the value in the maximum variable, then replace the value of the maximum variable with the value of the fourth variable

It can be seen that we compared each number (denoted by X) with the variable maximum, as follows

pseudocode:
input Х
if (maximum < X), then
  maximum = X
The main thing in this code is to determine what initial value the variable maximum will have.
Usually, when solving the problem of finding the maximum or minimum, the initial value of the variable maximum is assigned equal to the first number.
Thus, the above code must be executed 1 times less than the number of numbers (since the first number must be entered and stored as the initial value of the variable maximum).
If we have the number of numbers set from the keyboard (for example, into the variable n), then we can organize a cycle (from 2 to n), using the same variable to store the number.
Try to write the whole program yourself

Problem

Enter the number N and then N numbers, one per line
It is necessary to outpur the maximum number among all the numbers entered.

Input: 
in the first line the number N is entered - the number of numbers (N <= 100)
then one by one in the line there are N numbers (all numbers are integers not exceeding 10,000 in absolute value)

Output: 
output the maximum number of all N numbers.

Examples
Input Output
1 5
0
1
2
3
4
4