using System; namespace yukicoder { class Program { static void Main(string[] args) { int a = int.Parse(Console.ReadLine()); string[] s = Console.ReadLine().Trim().Split(' '); int b; int[] c = new int[a]; int ans = 0; int count = 0; for (int i = 0; i < a; i++) { b = int.Parse(s[i]); for (int j = 1; j <= a; j++) { if (b == j) { c[j - 1]++; } } } for (int x = 1; x < a; x++) { if (c[x] >= count) { ans = int.Parse(s[x]); count = c[x]; } } Console.WriteLine(ans ); } } }