import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; class Birds{ int type; int count; public Birds(){ type = 0; count = 0; } public void increaseCount(){ this.count++; } public void setData(int x,int y){ this.type =x; this.count = y; } } public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); Birds[] obj = new Birds[5]; for(int i =0;i<5;i++){ obj[i] = new Birds(); obj[i].setData(i+1,0); } int n = in.nextInt(); int[] types = new int[n]; for(int types_i=0; types_i < n; types_i++){ types[types_i] = in.nextInt(); if(types[types_i] == 1){ obj[0].increaseCount(); }else if(types[types_i] == 2){ obj[1].increaseCount(); }else if(types[types_i] == 3){ obj[2].increaseCount(); }else if(types[types_i] == 4){ obj[3].increaseCount(); }else if(types[types_i] == 5){ obj[4].increaseCount(); }else{ System.exit(0); } } Birds temp = new Birds(); for(int i=0;i<5;i++){ for(int j=0;j<4;j++){ temp.setData(0,0); if(obj[j].count < obj[j+1].count){ temp.setData(obj[j].type,obj[j].count); obj[j].setData(obj[j+1].type,obj[j+1].count); obj[j+1].setData(temp.type,temp.count); } } } int min_type = 0; int max_count = 0; max_count = obj[0].count; min_type = obj[0].type; for(int i=0;i<5;i++){ if(obj[i].count == max_count){ if(obj[i].type < min_type){ min_type = obj[i].type; } } } System.out.println(""+min_type); } }