#include <bits/stdc++.h>
using namespace std;
template <class T>
class segtree {
  vector<T> tree;

 public:
  segtree(const int n) : tree(n * 2) {}
  int base() const { return tree.size() / 2; }
  void update(int i, const T &v) {
    i += base();
    tree[i] = v;
    while (i /= 2) tree[i] = tree[i * 2] + tree[i * 2 + 1];
  }
  T fold(int f, int l) const {
    f += base();
    l += base();
    T accl, accr;
    while (f < l) {
      if (f & 1) accl = accl + tree[f++];
      f /= 2;
      if (l & 1) accr = tree[--l] + accr;
      l /= 2;
    }
    return accl + accr;
  }
};
long long int k;
struct hoge {
  bool flip;
  long long int sum;
  hoge(bool x = 0, long long int y = 0) : flip(x), sum(y) {}
  hoge operator+(const hoge &r) const {
    if (flip)
      return hoge(!r.flip, (sum - r.sum + k) % k);
    else
      return hoge(r.flip, (sum + r.sum) % k);
  }
};
long long int getmod(const long long int a) { return (a % k + k) % k; }
hoge make(const long long int a) {
  if (a != 0)
    return hoge(0, a);
  else
    return hoge(1, 0);
}
int gcd(int a, int b) {
  if (a < b) swap(a, b);
  while (b != 0) a %= b, swap(a, b);
  return a;
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  float sum = 0;
  for (int i = 0; n > i; i++) cin >> a[i], sum += a[i];
  sum /= n;
  pair<float, int> Min = {999999, 0};
  for (int i = 0; n > i; i++) Min = min(Min, {fabs(sum - a[i]), i});
  cout << Min.second << endl;
  return 0;
}
