#include <bits/stdc++.h>
using namespace std;
bool compare_by_b(pair<string, int64_t> a, pair<string, int64_t> b) {
  if (a.second != b.second)
    return a.second < b.second;
  else
    return a.first < b.first;
}
bool my_compare(pair<string, int64_t> a, pair<string, int64_t> b) {
  if (a.first != b.first) return a.first < b.first;
  if (a.second != b.second)
    return a.second > b.second;
  else
    return true;
}
int64_t factorial(int64_t n) {
  int64_t x = 1;
  for (int64_t i = 1; i <= n; i++) (x *= i) %= 1000000007;
  return x;
}
int64_t gcd(int64_t a, int64_t b) {
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
int64_t lcm(int64_t a, int64_t b) { return a / gcd(a, b) * b; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64_t n, sum = 0;
  cin >> n;
  vector<int64_t> t(n);
  for (int64_t i = 0; i < n; i++) {
    int64_t a;
    cin >> a;
    t[i] = a;
    sum += a;
  }
  double ave = sum / n;
  double ans = 0, mini = abs(ave - t[0]);
  for (int64_t i = 1; i <= n - 1; i++) {
    if (mini > abs(ave - t[i])) {
      ans = i;
      mini = abs(ave - t[i]);
    }
  }
  cout << ans << endl;
  return 0;
}
