#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
const long long int MOD = 1e9 + 7;
const long long int LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
class CompareDist {
 public:
  bool operator()(pair<long long int, long long int> n1,
                  pair<long long int, long long int> n2) {
    if (n1.first != n2.first)
      return n1.first < n2.first;
    else
      return n1.second < n2.second;
  }
};
__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
bool contain(int mask, int position) {
  if ((mask & (1 << position)))
    return true;
  else
    return false;
}
long long int gcd(long long int a, long long int b) {
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
long long int lcm(long long int a, long long int b) {
  return a * b / gcd(a, b);
}
signed main() {
  double n;
  cin >> n;
  double sum = 0;
  vector<double> a(n);
  for (int i = 0; i < (int)(n); i++) {
    double b;
    cin >> b;
    sum += b;
    a[i] = b;
  }
  double ave = sum / n;
  double dif = 100000.0;
  int idx = -1;
  for (int i = 0; i < (int)(n); i++) {
    if (abs(ave - a[i]) < dif) {
      dif = abs(ave - a[i]);
      idx = i;
    }
  }
  cout << idx << endl;
  return 0;
}
