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); // your code goes here Console.WriteLine(GetMostCommonVal(types, n)); } static int GetMostCommonVal(int[] a, int n) { var currCount = new int[5]; for (var i = 0; i < n; i++) { currCount[a[i]-1]++; } var max = currCount[0]; var maxType = 0; for (var i =1; i < currCount.Length; i++) { if (currCount[i] > max) { max = currCount[i]; maxType = i; } } return maxType+1; } }