#include <bits/stdc++.h>
using namespace std;
int main() {
  double a, cou = 0, ave = 0, sa, ans, ans2 = -1, p, q;
  vector<int> x(a);
  vector<int> y(a);
  cin >> a;
  for (int i = 0; i < a; i++) {
    cin >> x[i];
    y[i] = x[i];
    cou += x[i];
  }
  sort(y.begin(), y.end());
  ave = cou / a;
  sa = ave - y[0];
  for (int i = 1; i < a; i++) {
    if (sa = 0) {
      ans = y[i];
      break;
    } else if (sa < 0) {
      p = ave - y[i - 1];
      q = y[i] - ave;
      if (p > q) {
        ans = y[i];
        break;
      } else if (q > p) {
        ans = y[i - 1];
        break;
      } else {
        ans = y[i];
        ans2 = y[i - 1];
        break;
      }
    } else {
      sa = ave - y[i];
    }
  }
  for (int i = 0; i < a; i++) {
    if (ans == x[i] || ans2 == x[i]) {
      cout << i;
      return 0;
    }
  }
}
