#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v(n + 1);
  long long sum = 0, average = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
  }
  for (auto x : v) sum += x;
  average = sum / n;
  int diff = average - v[0];
  int closeToAverage = (diff >= 0) ? diff : diff * -1;
  int pos = 0;
  for (int i = 1; i < n; i++) {
    diff = (average - v[i]);
    diff = (diff >= 0) ? diff : diff * -1;
    if (diff < closeToAverage) {
      closeToAverage = diff;
      pos = i;
    }
  }
  printf("%d\n", pos);
  return 0;
}
