#include <fstream>
#include <unordered_map>
using namespace std;
int N;
unordered_map<int, int> mappings;
unordered_map<int,int>::iterator it;
ifstream fin("elmaj.in");
ofstream fout("elmaj.out");
int main(){
fin >> N;
int x, count = -1, who = -1;
for(int i = 0; i < N; i++){
fin >> x;
it = mappings.find(x);
if(it == mappings.end())
mappings[x] = 1;
else
mappings[x] += 1;
}
for (unordered_map<int,int>::iterator it=mappings.begin(); it!=mappings.end(); ++it){
if(it->second > count){
count = it->second;
who = it->first;
}
}
if(count >= N/2 + 1)
fout << who << " " << count << "\n";
else
fout << "-1\n";
return 0;
}