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[] frequency = new int[n]; int[] typeTable = new int[5]; for(int v = 1; v < 6; v++) { typeTable[v-1] = v; } for(int i = 0; i < n; i++) { switch (types[i]) { case 1: frequency[0] += 1; break; case 2: frequency[1] += 1; break; case 3: frequency[2] += 1; break; case 4: frequency[3] += 1; break; case 5: frequency[4] += 1; break; } } int max = 0; int maxIndex = 0; for(int k = 4; k > -1; k--) { if(frequency[k] >= max) { if(frequency[k] > max) { max = frequency[k]; maxIndex = k; } else if(frequency[k] == max) { if(k < maxIndex) { max = frequency[k]; maxIndex = k; } } } } System.out.println(typeTable[maxIndex]); } }