#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[10000], i, max, j = 0, flag = 0;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  max = a[0];
  for (i = 1; i < n; i++) {
    if (a[i] >= max) {
      max = a[i];
      j = i;
      flag = 1;
    }
  }
  if (flag == 1)
    cout << j + 1 << "\t";
  else
    cout << 1 << "\t";
  sort(a, a + i);
  cout << a[n - 2];
  return 0;
}
