#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, med, pos;
cin >> n;
int arr1[n];
int arr2[n];
for(i=0; i<n; i++) { cin >> arr1[i]; arr2[i]=arr1[i]; }
sort(arr2, arr2+n);
med = arr2[n/2];
for(i=0; i<n; i++) {
if(med==arr1[i]){pos=i; break;}
}
cout << med << ' ' << pos;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCWludCBuLCBpLCBtZWQsIHBvczsKCWNpbiA+PiBuOwoJaW50IGFycjFbbl07CglpbnQgYXJyMltuXTsKCWZvcihpPTA7IGk8bjsgaSsrKSB7IGNpbiA+PiBhcnIxW2ldOyBhcnIyW2ldPWFycjFbaV07IH0KCXNvcnQoYXJyMiwgYXJyMituKTsKCW1lZCA9IGFycjJbbi8yXTsKCWZvcihpPTA7IGk8bjsgaSsrKSB7CgkJaWYobWVkPT1hcnIxW2ldKXtwb3M9aTsgYnJlYWs7fQoJfQoJY291dCA8PCBtZWQgPDwgJyAnIDw8IHBvczsKCXJldHVybiAwOwp9