12399 - Beautiful Number   

Description

Let’s define an array element arr[i] is beautiful if there’s no element before arr[i] is greater than arr[i].In the other words, if arr[i] is beautiful, then arr[iarr[j] is false for all ≤ i.

Your task is to find the largest beautiful element.

 

Hints:The variable used to record largest beautiful element should be initialized small enough

 

Input

The first line contains an integer N, meaning the size of array. The second line contains N integers, denoting each element in array.

  • 1 <= n <= 1000
  • 1 <= array elements <= 100000

Output

Print the largest beautiful element.
Remember to print ‘\n’ on the end of each line.

Sample Input  Download

Sample Output  Download

Tags




Discuss