Find Maximum ValueEasy

Find Maximum Value

EasyPractice library · +10 XPgreedysimple iteration

Given a list of N integers, find and print the largest integer in the list. If the list is empty, print 0.

Input

The first line contains an integer N, the number of integers. The second line contains N space-separated integers.

Output

Print a single integer, the maximum value in the list. If the list is empty, print 0.

Constraints

1 <= N <= 1000. Each integer will be between -10^9 and 10^9.

Time limit 1 s (native code; slower languages get more)Memory 256 MB14 hidden tests

Example 1

Input
5
10 5 20 15 30
Output
30

The maximum value in the list is 30.

Example 2

Input
3
-1 -5 -2
Output
-1

The maximum value in the list is -1.

Hints