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(); // an array containing the total number of birds for each type int[] typesSums = new int[5]; // loop through the birds for(int i = 0; i < n; i++) { switch (in.nextInt()) { case 1: typesSums[0]++; break; case 2: typesSums[1]++; break; case 3: typesSums[2]++; break; case 4: typesSums[3]++; break; case 5: typesSums[4]++; break; } } in.close(); // look for highest sum int maxSum = -1; int minTypeId = 6; for (int i = 0; i < typesSums.length; i++) { if (typesSums[i] > maxSum) { maxSum = typesSums[i]; minTypeId = i + 1; // set initial smallest type id } } // look for duplicates of highest sum and store indexes that has same number of birds for (int i = 0; i < typesSums.length; i++) { if (typesSums[i] == maxSum) { // duplicate found if (i + 1 < minTypeId) { minTypeId = i + 1; } } } System.out.println(minTypeId); } }