import sys
from collections import deque
import copy

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [long(input_raw[0])]
    A = []
    input_raw = read_func().strip().split()
    S = 0.0
    for i in range(N):
        A.append(int(input_raw[i]))
        S += int(input_raw[i])
    Ave = S/N

    min_err = float(sys.maxint)
    min_idx = 0
    for i in range(N):
        err = abs(A[i] - Ave)
        if err < min_err:
            min_err = err
            min_idx = i
    print min_idx



if __name__ == '__main__':
    main()