def main():

    n = int(eval(input()))

    a_list = list(map(int, input().split()))

    mean_a = sum(a_list) / n

    diff_list = [abs(a - mean_a) for a in a_list]

    min_a = min(diff_list)

    print((diff_list.index(min_a)))





if __name__ == "__main__":

    main()

def main():

    n = int(eval(input()))

    a_list = list(map(int, input().split()))

    sum_a = sum(a_list)

    min_val = 100

    min_index = 0



    for i, a in enumerate(a_list):

        d = abs(n * a - sum_a)

        if d < min_val:

            min_val = d

            min_index = i



    print(min_index)





if __name__ == "__main__":

    main()

def main():
    n = int(eval(input()))
    a_list = list(map(int, input().split()))
    mean_a = sum(a_list) / n
    diff_list = [abs(a - mean_a) for a in a_list]
    min_a = min(diff_list)
    print((diff_list.index(min_a)))


if __name__ == "__main__":
    main()

def main():
    n = int(eval(input()))
    a_list = list(map(int, input().split()))
    sum_a = sum(a_list)
    min_val = 100
    min_index = 0
    for i, a in enumerate(a_list):
        d = abs(n * a - sum_a)
        if d < min_val:
            min_val = d
            min_index = i
    print(min_index)


if __name__ == "__main__":
    main()

-    mean_a = sum(a_list) / n -    diff_list = [abs(a - mean_a) for a in a_list] -    min_a = min(diff_list) -    print((diff_list.index(min_a))) +    sum_a = sum(a_list) +    min_val = 100 +    min_index = 0 +    for i, a in enumerate(a_list): +        d = abs(n * a - sum_a) +        if d < min_val: +            min_val = d +            min_index = i +    print(min_index)