using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static int MigratoryBirds(int[] types) { Dictionary d = new Dictionary(); int heightestCount = 0; foreach(int type in types) { if (!d.ContainsKey(type)) { d[type] = 1; }else { d[type]++; } if (heightestCount < d[type]) { heightestCount = d[type]; } } int m = d.Where(x => x.Value == heightestCount).Min(x=>x.Key); return m; } 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); // your code goes here int a= MigratoryBirds(types); Console.WriteLine(a); } }