#include <iostream>
#include <fstream>
using namespace std;
ifstream fin ("elmaj.in");
ofstream fout ("elmaj.out");
int main()
{
long long a,b[1000],c,d=0,e=0,a1,max1=0;
fin>>a;
a1=a/2;
a1+=1;
if(a>=1 && a<=1000000)
{
for(int i=0;i<a;++i)
{
fin>>b[i];
}
for(int i=0;i<a;i++)
{
e=0;
c=b[i];
for(int j=0;j<a;j++)
{
if(b[j]==c)
{
e++;
}
}
if(e>=a1)
{
if(max1<e)
max1=e;
}
}
for(int i=0;i<a;++i)
{
e=0;
c=b[i];
for(int j=0;j<a;j++)
{
if(b[j]==c)
{
e++;
}
}
if(e==max1)
{
d=b[i];
}
}
if(max1!=0)
{
fout<<d<<" "<<max1;
}else{fout<<-1;}
}
return 0;
}