#include <bits/stdc++.h>
int arr[100000];
int main() {
  int n;
  scanf("%d", &n);
  int mayor = 0;
  int mayori = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
    if (arr[i] > mayor) {
      mayor = arr[i];
      mayori = i;
    }
  }
  printf("%d ", mayori);
  arr[mayori] = 0;
  int aux = 0;
  for (int i = 1; i <= n; i++) {
    if (arr[i] > aux) {
      aux = arr[i];
    }
  }
  printf("%d", aux);
  return 0;
}
