#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  vector<int>::iterator iter, iter2;
  iter = max_element(x.begin(), x.end());
  int y = *iter;
  for (int i = 0; i < n; i++) {
    if (x[i] == y) {
      cout << i + 1 << endl;
      break;
    }
  }
  x.erase(iter);
  iter2 = max_element(x.begin(), x.end());
  cout << *iter2 << endl;
  return 0;
}
