#include <bits/stdc++.h>
using namespace std;
int main() {
  int v[1002];
  int n, temp, idx = -1;
  cin >> n;
  int maxm = -1, sec = -1;
  for (int i = 1; i <= n; i++) {
    cin >> temp;
    v[i] = temp;
    if (temp > maxm) {
      idx = i;
      maxm = temp;
    }
  }
  sort(v, v + n + 1);
  cout << idx << " " << v[n - 1];
  return 0;
}
