import java.util.*; public class Run { public static void main (String arg[]) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); if (N < 1||N > 100000) System.exit(1); HashMap ev = new HashMap<>(); int[] L = new int[N]; for (int i = 0; i < N; i++) { L[i] = scan.nextInt(); if (L[i] < 1||L[i] > 6) System.exit(1); if (!ev.containsKey(L[i])) ev.put(L[i], 1); else ev.put(L[i], ev.get(L[i]) + 1); } int max = L[0]; for (int i : L) { if (ev.get(max) < ev.get(i)) max = i; else if (ev.get(max)==ev.get(i)){ if (max < i) max = i; } } System.out.println(max); } }