def main():

    N = int(eval(input()))

    A = [int(i) for i in input().split()]

    avg = sum(A)/N

    ans = 0

    mi = abs(A[0] - avg)

    for i, a in enumerate(A[1:], start=1):

        if abs(a - avg) < mi:

            ans = i

            mi = abs(a - avg)

    print(ans)





if __name__ == '__main__':

    main()

def main():

    N = int(eval(input()))

    A = [int(i) for i in input().split()]

    avg = sum(A)/N

    mi = abs(A[0] - avg)

    idx = 0

    for i, a in enumerate(A[1:], start=1):

        if abs(a - avg) < mi:

            mi = abs(a - avg)

            idx = i

    print(idx)





if __name__ == '__main__':

    main()

def main():
    N = int(eval(input()))
    A = [int(i) for i in input().split()]
    avg = sum(A) / N
    ans = 0
    mi = abs(A[0] - avg)
    for i, a in enumerate(A[1:], start=1):
        if abs(a - avg) < mi:
            ans = i
            mi = abs(a - avg)
    print(ans)


if __name__ == "__main__":
    main()

def main():
    N = int(eval(input()))
    A = [int(i) for i in input().split()]
    avg = sum(A) / N
    mi = abs(A[0] - avg)
    idx = 0
    for i, a in enumerate(A[1:], start=1):
        if abs(a - avg) < mi:
            mi = abs(a - avg)
            idx = i
    print(idx)


if __name__ == "__main__":
    main()

-    ans = 0 +    idx = 0 -            ans = i -    print(ans) +            idx = i +    print(idx)