#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  if (cin >> n)
    if (n > 0) {
      vector<long long> v(n + 1);
      long long sum = 0;
      for (int i = 0; i < n; i++) {
        cin >> v[i];
      }
      for (auto x : v) sum += x;
      double average = (sum / (double)n);
      long long diff = average - v[0];
      long long closeToAverage = (diff > 0) ? diff : diff * -1;
      int pos = 0;
      for (int i = 1; i < n; i++) {
        diff = (average - v[i]);
        diff = (diff > 0) ? diff : diff * -1;
        if (diff < closeToAverage) {
          closeToAverage = diff;
          pos = i;
        }
      }
      cout << pos << "\n";
    } else {
      cout << "0"
           << "\n";
    }
  return 0;
}
