import java.util.Scanner;
public class Main {
public static int [] min={0,0,0,0,0,0,0,0,0};
public static int top=0,topnum=0;
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int num = keyboard.nextInt();
for (int i = 0; i < num; i++)
{
int a = keyboard.nextInt();
for (int m = 0; m <= 9; m++)
{
if (m == a)
{
min[m]++;
}
}
}
result();
}
public static void result()
{
for(int i=0;i<9;i++)
{
if(min[i]>top)
{
top=min[i];
topnum=i;
}
}
System.out.println(topnum+"\n"+top);
}
}
출력은제대로되는데..ㅠ