#include <bits/stdc++.h>
using namespace std;
template <class T>
void show(const vector<T> &a) {
  for (T x : a) cout << x << " ";
  cout << '\n';
}
const long long sze = 3e5 + 50, oo = 1e18 + 500, mod = 1000000007;
const long double eps = 5e-10, PI = 2 * acos(0.0);
vector<long long> vertices[sze];
vector<char> visit(sze, false);
vector<long long> arr(sze, 0);
long long n, m, k;
long long cnt = 0;
long long x, y;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  vector<long double> a(n);
  long double avr = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    avr += a[i];
  }
  avr /= n;
  vector<pair<long long, long long> > ind;
  for (long long i = 0; i < n; i++) {
    ind.push_back(make_pair(fabs(a[i] - avr), i));
  }
  sort(ind.begin(), ind.end());
  cout << ind[0].second;
  return 0;
}
