#include <bits/stdc++.h>   using namespace std;   long long int N = 100000, M = 100000;   long long int MOD = 1000000007;   void solve() {     long long int n;     cin >> n;     long long int a[n + 1], b[n + 1];     for (long long int i = 0; i < n; i++) cin >> a[i];     for (long long int i = 0; i < n; i++) {       b[i] = a[i] - i;       if (b[i] < 0)         b[i] = 0;       else if (b[i] % n == 0)         b[i] = b[i] / n;       else         b[i] = (b[i] / n) + 1;     }     for (long long int i = 0; i < n; i++) b[i] = i + (n * b[i]);     long long int min1 = b[0];     long long int ans = 0;     for (long long int i = 0; i < n; i++) {       if (min1 > b[i]) {         min1 = b[i];         ans = i;       }     }     cout << ans + 1;   }   int main() {     long long int t = 1;     while (t--) {       solve();     }   }   