#include <fstream>
using namespace std;
ifstream fin("maxim4.in");
ofstream fout("maxim4.out");
int main(){
int n,x;
fin >> n;
int max = -1, maxap=0;
for(int i = 0; i < n; i++){
fin >> x;
if(max == -1 || x > max){
max = x;
maxap = 0;
}
if(max == x)
maxap ++;
}
fin.close();
fout << max << " " << maxap;
fout.close();
}