#include <bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int n,x,a[3001]={0},c=0;
scanf("%d",&n);
for(int i=1; i<=n; ++i)
{
scanf("%d",&x);
a[x]++;
c=max(c,a[x]);
}
for(int i=1; i<=30000; ++i)
if(a[i]==c) printf("%d %d\n",i,c);
return 0;
}