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 totalTypes=5; int n = in.nextInt(); int[] types = new int[totalTypes]; int commonNum=-1; int commonType=-1; for(int i=0; i < n; i++){ int index=in.nextInt()-1; types[index]++; if(types[index] > commonNum){ commonNum=types[index]; commonType=index; }else if(types[index] == commonNum){ commonType= (commonType>index) ? index : commonType; } } System.out.println((commonType+1)); } }