#include <bits/stdc++.h>
using namespace std;
const int maxn = 1024;
int main() {
  int n, k;
  cin >> n;
  vector<long long> a(n);
  long long s = 0;
  for (auto& v : a) cin >> v, s += v;
  double avg = s / n;
  double minDiff = fabs(avg - a[0]);
  for (auto& v : a) {
    minDiff = min(minDiff, fabs(avg - v));
  }
  for (int e = 0; e < n; e++) {
    double no = fabs(avg - a[e]);
    if (fabs(no - minDiff) < 1e-9) {
      cout << e << endl;
      return 0;
    }
  }
  return 0;
}
