#include <bits/stdc++.h>
using namespace std;
long long int power(long long int base, unsigned int n) {
  long long int res = 1;
  while (n) {
    if (n & 1) res = res * base;
    base = base * base;
    n = n / 2;
  }
  return res;
}
int main() {
  long long int n, i, mini = 9000000000000000000, div, val;
  cin >> n;
  long long int a[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] <= i) {
      mini = min(mini, i + 1);
    } else {
      div = a[i] / n;
      val = div * n + i + 1;
      if (a[i] > val - 1) val += n;
      mini = min(mini, val);
    }
  }
  if (mini > n) {
    div = mini / n;
    mini -= div * n;
    mini = (mini == 0 ? n : mini);
  }
  cout << mini << endl;
  cerr << "time taken : " << (float)clock() / (float)CLOCKS_PER_SEC << " secs"
       << endl;
  return 0;
}
