#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, vmax,cmax=1;
cin >> n;
int arr[n];
for(i=0; i<n; i++) cin >> arr[i];
sort(arr, arr+n);
i=n-2;
vmax=arr[n-1];
while(i>=0 && vmax==arr[i]){
cmax++; i--;
}
cout << arr[0] <<' ' << cmax;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCWludCBuLCBpLCB2bWF4LGNtYXg9MTsKCWNpbiA+PiBuOwoJaW50IGFycltuXTsKCWZvcihpPTA7IGk8bjsgaSsrKSBjaW4gPj4gYXJyW2ldOwoJc29ydChhcnIsIGFycituKTsKCWk9bi0yOwoJdm1heD1hcnJbbi0xXTsKCXdoaWxlKGk+PTAgJiYgdm1heD09YXJyW2ldKXsKCQljbWF4Kys7IGktLTsKCX0KCWNvdXQgPDwgYXJyWzBdIDw8JyAnIDw8IGNtYXg7CglyZXR1cm4gMDsKfQ==