#include <fstream>
using namespace std;
///// DESCRIPTION
// THIS PROGRAM FINDS THE MAJORITY
// ELEMENT FROM A VECTOR OF N ELEMENTS
// MAJ EL = APPEARS AT LEAST (N/2) + 1 TIMES
/////
int main(int argc, char **argv)
{
// INPUT
int n;
ifstream indata("elmaj.in");
indata >> n;
int freq[2000000001], max = 0;
for (int i = 1; i <= 2000000001; i++) {
freq[i] = 0;
}
int aux;
for (int i = 0; i < n; i++) {
indata >> aux;
freq[aux]++;
if (freq[aux] > freq[max]) {
max = aux;
}
}
indata.close();
// FIND A MAJORITY ELEMENT AND OUTPUT IT
ofstream outdata("elmaj.out");
if (freq[max] >= (n /2) + 1) {
outdata << max << " " << freq[max];
} else {
outdata << -1 << " " << 0;
}
outdata.close();
return 0;
}