CSharp · Console
using System;
public class Program
{
public static void Main()
{
int n = int.Parse(Console.ReadLine());
int[] cats = new int[n];
for (int i = 0; i < n; i++)
{
cats[i] = int.Parse(Console.ReadLine());
}
Array.Sort(cats);
int votes = 0;
int winner = 0;
int counter = 1;
for (int i = 0; i < n - 1; i++)
{
if (cats[i] == cats[i + 1])
{
counter++;
if (votes < counter)
{
votes = counter;
winner = cats[i];
}
}
else
{
counter = 1;
}
}
Console.WriteLine(winner);
}
}