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 if (n < 5 || n > 2e5) { return; } HashMap birds = new HashMap<>(); for (int i = 0; i < n ; i++) { if (types[i] < 0 || types[i] > 5) { return; } int count = birds.containsKey(types[i]) ? birds.get(types[i]) : 0; birds.put(types[i], count + 1); } Map.Entry maxEntry = null; for (Map.Entry entry : birds.entrySet()) { if (maxEntry == null || entry.getValue().compareTo(maxEntry.getValue()) > 0) { maxEntry = entry; } } System.out.print(maxEntry.getKey()); } }