#include <bits/stdc++.h>
using namespace std;
int a[110];
int main() {
  double n;
  double x;
  while (cin >> n) {
    if (n == 0) break;
    long long sum = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      sum += a[i];
    }
    x = (double)sum / n;
    double minn = abs(a[0] - x);
    int ans = 0;
    for (int i = 0; i < n; i++) {
      a[i] = abs(a[i] - x);
      if (a[i] < minn) {
        minn = a[i];
        ans = i;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
