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[] end = new int[5]; end[0] = 0; end[1] = 0; end[2] = 0; end[3] = 0; end[4] = 0; for(int i = 0; i < n; i++){ int x = types[i]; if(x == 1){ end[0]++; }else if(x == 2){ end[1]++; }else if(x == 3){ end[2]++; }else if(x == 4){ end[3]++; }else if(x == 5){ end[4]++; } } int endd[] = end; for(int i = 0; i < 5; i++){ int count = 0; int highest = 0; int place = 0; for(int a = count; a < 5; a++){ count++; if(end[a] > highest){ highest = end[a]; place = a; } } int swap = end[i]; end[i] = end[place]; end[place] = swap; } for(int i = 0; i < 5; i++){ if(endd[i] == end[4]){ System.out.println(i); } } return; } }