#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  bool all = true;
  int maxi = 1e9;
  for (int i = 0; i < n; i++) cin >> vec[i], maxi = min(maxi, vec[i] / n);
  for (int i = 0; i < n; i++) vec[i] -= maxi * n;
  int rem = 0;
  for (int i = 0; i < n; i++) {
    vec[i] -= rem;
    if (vec[i] <= 0) return cout << i + 1, 0;
    rem++;
  }
  for (int i = 0; i < n; i++) {
    vec[i] -= rem;
    if (vec[i] <= 0) return cout << i + 1, 0;
    rem++;
  }
  for (int i = 0; i < n; i++) {
    vec[i] -= rem;
    if (vec[i] <= 0) return cout << i + 1, 0;
    rem++;
  }
  return 0;
}
