#include <iostream>
#include <map>
using namespace std;
int main()
{
int n;
scanf("%d", &n);
int i;
long long num;
map<long long, int> m;
for(i = 1; i <= 2 * n; i++)
{
scanf("%lld", &num);
m[num]++;
}
map<long long, int> ::iterator it, end;
end = m.end();
int maxcount = 0, samecount = 0, curcount;
long long curnum, resnum;
for(it = m.begin(); it != end; it++)
{
curnum = it->first;
curcount = it->second;
if(curcount > maxcount)
{
maxcount = curcount;
samecount = 1;
resnum = curnum;
}
else if(curcount == maxcount)
{
samecount++;
}
}
if(samecount == 1)
{
printf("%lld %d\n", resnum, maxcount);
}
else
{
printf("%lld %d %d\n", resnum, maxcount, samecount);
}
system("pause");
return 0;
}