using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace lecture { class Program { public static void Main(String[] args) { int N = int.Parse(Console.ReadLine()); int[] L = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToArray(); Array.Sort(L); int X,Y; int Ans = 0; int counta = 0; int countb = 0; for(int i = 0; i < L.Length-1; i++) { X = L[i]; Y = L[i+1]; if(X == Y) { counta++; if( (X > Ans) && (counta > countb)) { Ans = X; countb = counta; } } } Console.WriteLine(Ans); } } }