import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long largestValue(int[] A) { // Return the largest value of any of A's nonempty subarrays. int i,j,k,l=A.length,m,max=0,temp;; for(i=0;i"+j); temp=0; for(k=i;kmax) max=temp; } } return max; } 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 = largestValue(A); System.out.println(result); in.close(); } }