import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

/// double で計算しても AC はとれる
int calc(int[] a) {
    double agv = 1.0 * a.sum / a.length;
    double best = int.max;
    int ans = 0;
    for (int i = 0; i < a.length; i++) {
        double d = abs(agv - a[i]);
        if (d < best) {
            best = d;
            ans = i;
        }
    }
    return ans;
}

/// 整数のみで答えを求める
int calc2(int[] a) {
    int sum = a.sum;
    int ans = 0;
    int best = int.max;
    int n = cast(int) a.length;
    for (int i = 0; i < a.length; i++) {
        int d = abs(sum - a[i] * n);
        if (d < best) {
            best = d;
            ans = i;
        }
    }
    return ans;
}

void main() {
    readint;
    auto a = readints;
    // writeln(calc(a));
    writeln(calc2(a));
}
