#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long v[n + 1];
  long long menor = 1e18;
  for (long long i = 1; i <= n; i++) {
    cin >> v[i];
    long long resul = 0;
    long long esq = 0, dir = 1e9, mid, x;
    while (esq <= dir) {
      mid = (esq + dir) / 2;
      x = i + n * mid;
      if (x <= v[i])
        esq = mid + 1;
      else {
        dir = mid - 1;
        resul = x;
      }
    }
    menor = min(resul, menor);
  }
  if (menor % n == 0)
    cout << n << endl;
  else
    cout << menor % n << endl;
}
