#include <iostream>
#include <cmath>
using namespace std;
int prim(int a);
int main()
{
int n,v[100],i,maxim=0,aparitii=1;
cin>>n;
for(i=0;i<n;i++) {
cin>>v[i];
if(v[i]==maxim && maxim!=0) aparitii++;
if(prim(v[i]) && v[i]>maxim) {aparitii=1; maxim=v[i];}
}
cout<<maxim<<" "<<aparitii<<'\n';
return 0;
}
int prim(int a) {
int i;
for(i=2;i<=sqrt(a);i++) {
if(a%i==0) return 0;
}
return 1;
}