using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); string[] types_temp = Console.ReadLine().Split(' '); int[] types = Array.ConvertAll(types_temp,Int32.Parse); int[] dataStore = new int[6]; int highestCount = 0; int highestType = 0; foreach(var type in types){ dataStore[type]++; if(highestCount < dataStore[type]){ highestCount = dataStore[type]; highestType = type; } else if (highestCount == dataStore[type]){ if(type < highestType){ highestType = type; } } } Console.WriteLine(highestType); } }