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(); } // your code goes here //Denoting Counters for the different birds int count1 = 0; int count2 = 0; int count3 = 0; int count4 = 0; int count5 = 0; //This code Segment uses counters to keep a tab on the number of birds for each and every type. for(int i = 0 ; i < n ; i++){ if(types[i] == 1){ count1++; } else if(types[i] == 2){ count2++; } else if(types[i] == 3){ count3++; } else if(types[i] == 4){ count4++; } else if(types[i] == 5){ count5++; } } int max = 0;//Initially We have no common birds int a[] = {count1 , count2 , count3 , count4 , count5};//Array contains the number of each type int b[] = {1 , 2 , 3 , 4 , 5};//Array contains the birds int maxim[] = new int[5]; int c[] = new int[n];//Array will only contain the most common birds //This Segment of code will tell us the maximum frequency of the most common bird for(int i = 0 ; i < 5 ; i++){ if(max <= a[i]){ max = a[i]; } } //This code segment will tell us the most common bird or the common bird with the lowest id int g = 0; int id; for(int i = 0 ; i < 5 ; i++){ if(a[i] == max){ maxim[g++] = b[i]; } } id = maxim[0]; System.out.print(id); } }