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 int[] a = new int[5] {0,0,0,0,0}; for(int i=0; i< n; i++) { a[types[i]-1]=a[types[i]-1]+1; } int maxSoFar =0; int maxRepSoFar =0; for(int i=0; i<5; i++) { if(a[i] > maxRepSoFar || (a[i]==maxRepSoFar && maxSoFar> i)) { maxRepSoFar = a[i]; maxSoFar = i; } } Console.WriteLine(maxSoFar+1); } }