#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
template <class T>
T &chmin(T &a, const T &b) {
  return a = min(a, b);
}
template <class T>
T &chmax(T &a, const T &b) {
  return a = max(a, b);
}
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
  for (auto &i : v) is >> i;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, vector<T> &v) {
  const string delimiter = "\n";
  for (int i = (int)(0); i < (int)(v.size()); i++) {
    os << v[i];
    if (i != v.size() - 1) os << delimiter;
  }
  return os;
}
int main() {
  cin.sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int n;
  cin >> n;
  vector<long double> a(n);
  cin >> a;
  long double m = 0;
  for (int i = (int)(0); i < (int)(n); i++) m += a[i];
  m /= long double(n);
  vector<int> v(n);
  for (int i = (int)(0); i < (int)(n); i++) v[i] = abs(m - a[i]);
  long double mn = 1e4;
  int ans = -1;
  for (int i = (int)(0); i < (int)(n); i++) {
    if (mn > v[i]) {
      mn = v[i];
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
