#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
while(cin>>n){
vector<int> count(30000,0);
vector<int> num(n,0);
for(int i=0;i<n;i++){
cin>>num[i];
count[num[i]]++;
}
int max=*max_element(count.begin(),count.begin()+n);
for(int i=0;i<30000;i++){
if(count[i]==max)
cout<<i<<" "<<max<<"\n";
}
}
return 0;
}