#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
long long LCM(long long a, long long b) { return a * b / GCD(a, b); }
unsigned GetDigit(unsigned num) { return std::to_string(num).length(); }
int tow(int n) {
  if (n == 0) return 1;
  int x = tow(n / 2);
  x *= x;
  if (n % 2 == 1) x *= 2;
  return x;
}
int SED(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
unsigned ND(unsigned num) { return std::to_string(num).length(); }
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int sum = 0;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sum /= n;
  int x = 1000000000;
  int y = 0;
  for (int i = 0; i < n; i++) {
    if (x > abs(sum - a[i])) {
      y = i;
      x = abs(sum - a[i]);
    }
  }
  cout << y << "\n";
  return 0;
}
