#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void maximize(T &a, T b) {
  a = max(a, b);
}
template <typename T>
inline void minimize(T &a, T b) {
  a = min(a, b);
}
template <typename T>
inline bool middle(T a, T b, T c) {
  return b <= a && a <= c;
}
template <class T>
inline bool MX(T &l, const T &r) {
  return l < r ? l = r, 1 : 0;
}
template <class T>
inline bool MN(T &l, const T &r) {
  return l > r ? l = r, 1 : 0;
}
inline void outputVI(vector<long long> x) {
  for (long long i = (0LL); i < (long long)((long long(x.size()))); i++) {
    cout << ((i) ? (" ") : ("")) << x[i];
  }
  cout << ("") << endl;
}
const long long SIZE1 = 5 * 1e5 + 1000;
const long long SIZE2 = 3010;
const long long SIZE3 = 400;
const long long SIZE = SIZE1;
const long long MAPSIZE = 40;
const long long p = 7 + 1e9;
const double INF = 1e18;
const long double EPS = 1e-7;
long long N, M, K, X, L, Y;
vector<long long> edges[SIZE];
long long vals[SIZE], maps[SIZE2][SIZE2], answer = 0LL;
long long A[SIZE];
long long B[SIZE];
long long solve() {
  cin >> N;
  long long sum = 0;
  for (long long i = (0LL); i < (long long)(N); i++) {
    cin >> A[i];
    sum += A[i];
  }
  double ave = sum / N;
  long long minium = 0;
  for (long long i = (0LL); i < (long long)(N); i++) {
    if (abs(A[minium] - ave) > abs(A[i] - ave)) {
      minium = i;
    }
  }
  cout << minium << endl;
  return 0;
}
signed main() {
  solve();
  cin >> N;
}
