import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner koko = new Scanner(System.in); int n = koko.nextInt(); int[] l = new int[n]; for(int i=0; i=max){ max=count; now=l[i]; } }else{ count=0; } } if(max==0){ System.out.println(l[n-1]); }else{ System.out.println(now); } } }