public class Solution { public static void main(String[] args) throws Exception { int i = 0; int max = Integer.MIN_VALUE; Scanner console = new Scanner(System.in); int input = console.nextInt(); if( input <= 0){ System.exit(0); } while(i < input){ int input2 = console.nextInt(); if(input2 > max) { max = input2; } i++; } System.out.println(max); console.close(); } }