#include <bits/stdc++.h>
using namespace std;
using ll = long long;
long long dx[] = {1, 0, -1, 0};
long long dy[] = {0, 1, 0, -1};
const long long INF = 2000000000;
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
ll fact(long long i) {
  if (i == 0) return 1;
  return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
bool isprime(ll a) {
  if (a < 2)
    return false;
  else if (a == 2)
    return true;
  else if (a % 2 == 0)
    return false;
  double m = sqrt(a);
  for (long long i = 3; i <= m; i += 2) {
    if (a % i == 0) {
      return false;
    }
  }
  return true;
}
ll ketasum(ll n) {
  ll sum = 0;
  while (n != 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
ll kind(vector<long long> SYURUI) {
  long long size = SYURUI.size();
  sort((SYURUI).begin(), (SYURUI).end());
  long long cnt = 1;
  for (long long i = 0; i < (long long)(size - 1); i++) {
    if (SYURUI[i] != SYURUI[i + 1]) cnt++;
  }
  return cnt;
}
signed main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < (long long)(N); i++) cin >> A[i];
  long long sum = 0;
  for (auto x : A) sum += x;
  sum /= N;
  long long MAX = INF;
  long long NUM = N - 1;
  for (long long i = N - 1; i >= 0; i--) {
    if (MAX >= abs(sum - A[i])) {
      MAX = abs(sum - A[i]);
      NUM = i;
    }
  }
  cout << NUM << endl;
}
