#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v) {
  o << "{";
  for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i];
  o << "}";
  return o;
}
int main() {
  int n, a, ans, best = 10000000;
  cin >> n;
  double tmp = 0;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> a;
    tmp += a;
    vec[i] = a;
  }
  tmp /= n;
  for (int i = 0; i < n; i++) {
    if (abs(tmp - vec[i]) < best) {
      best = abs(tmp - vec[i]);
      ans = i;
    }
  }
  cout << ans << "\n";
}
