#include <bits/stdc++.h>
using namespace std;
#define LL long long
map<LL,LL> ma;
const int M=1e5+10;
int main()
{
LL n,a,b=0;
cin >>n;
while(n--)
{
cin >> a;
ma[a]++;
b=max(ma[a],b);
}
map <LL, LL>::iterator t;
int f=0;
for ( t = ma.begin( ); t != ma.end( ); t++ )
{
if(t->second==b)
{
if(f!=0)
{
cout << " ";
}
else
{
f++;
}
cout << t->first ;
}
}
cout << endl;
cout << b <<endl;;
return 0;
}