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); long n = in.nextLong(); long[] types = new long[6]; for(int types_i=0; types_i < n; types_i++){ types[in.nextInt()] += 1; } long max =Long.MIN_VALUE; int smallerIndex = Integer.MIN_VALUE; for (int i = 1; i < types.length; i++) { if (types[i] > max) { max = types[i]; smallerIndex = i; }else if(types[i] == max){ if (i < smallerIndex) { smallerIndex = i; } } } System.out.println(smallerIndex); } }