import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] types = new int[n]; for(int types_i=0; types_i < n; types_i++){ types[types_i] = in.nextInt(); } int []arr=new int[5]; int k=0; int count=0; for(int i:types){ if(i>k){ count=0; k+=1; for(int j:types){ if(types[j]==k){ count+=1; } } } arr[k-1]=count; } int max=arr[0]; for(int l:arr){ if(l>=max) max=l; } int index=4; for(int x=4;x>=0;x--){ if(arr[x]==max) index=x; } System.out.println(index); } }