import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int gcdcom(int a, int b) { if (a == 0) return b; return gcdcom(b%a, a); } static long maximumValue(int[] a) { // Return the maximum value of f among all subsegments [l..r]. long high=-32766; for(int i=0;imax) max=a[k]; k++; } k=i+1; int result=a[i]; while(khigh) high=f; } } return high; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextInt(); } long result = maximumValue(a); System.out.println(result); in.close(); } }