#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<double> a(n);
    double sum = 0;
    for(int i = 0;i < n;i++){
          cin >> a[i];
          sum += a[i];
    }
    double ave = sum / n;
    double t = 101;
    int ans = -1;
    for(int i = a.size() - 1;i >= 0;i--){
          if(t >= abs(ave - a[i])){
                 t = abs(ave - a[i]);
                 ans = i;
          }
    }
    cout << ans << endl;
    
}

#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int N; cin >> N;
    vector<double> as(N); for (auto &ai : as) cin >> ai;
    const double avg = accumulate(as.begin(), as.end(), 0.0) / static_cast<double>(N);
    map<double, int> diff2IndexMap;
    for (int i = N - 1; i >= 0; --i)
    {
        diff2IndexMap[abs(as[i] - avg)] = i;
    }
    cout << diff2IndexMap.begin()->second << endl;
}
