#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:167772160000")
using namespace std;
int n;
long long a[51000];
long long reqUses[51000];
long long getUses(long long a, int day) {
  if (n % 7 == 0) {
    if (day % 7 == 0)
      return 1E10;
    else
      return a;
  }
  long long answer = ((a - 1) / 6) * 7;
  a -= ((a - 1) / 6) * 6;
  while (a > 0) {
    answer++;
    if (day % 7 != 0) a--;
    day = (day + n) % 7;
  }
  return answer;
}
int main() {
  cin >> n;
  for (int i = 1; i <= (n); i++) cin >> a[i];
  for (int i = 1; i <= (n); i++) reqUses[i] = getUses(a[i], i);
  pair<long long, long long> answer = pair<long long, long long>(1E15, 1);
  for (int i = 1; i <= (n); i++) {
    answer =
        min(answer, pair<long long, long long>((reqUses[i] - 1) * n + i, i));
  }
  cout << answer.second << endl;
  return 0;
}
