# dwacon5th-prelimsA - Thumbnail

def main():

    N = int(eval(input()))

    A = tuple(map(int, input().split()))

    avg = sum(A) / N

    D = sorted((abs(avg - a), i) for i, a in enumerate(A))

    print((D[0][1]))





if __name__ == "__main__":

    main()
# dwacon5th-prelimsA - Thumbnail

def main():

    N = int(eval(input()))

    A = tuple(map(int, input().split()))

    avg = sum(A) / N

    D = [(abs(avg - a), i) for i, a in enumerate(A)]

    print((min(D)[1]))





if __name__ == "__main__":

    main()
# dwacon5th-prelimsA - Thumbnail
def main():
    N = int(eval(input()))
    A = tuple(map(int, input().split()))
    avg = sum(A) / N
    D = sorted((abs(avg - a), i) for i, a in enumerate(A))
    print((D[0][1]))


if __name__ == "__main__":
    main()

# dwacon5th-prelimsA - Thumbnail
def main():
    N = int(eval(input()))
    A = tuple(map(int, input().split()))
    avg = sum(A) / N
    D = [(abs(avg - a), i) for i, a in enumerate(A)]
    print((min(D)[1]))


if __name__ == "__main__":
    main()

-    D = sorted((abs(avg - a), i) for i, a in enumerate(A)) -    print((D[0][1])) +    D = [(abs(avg - a), i) for i, a in enumerate(A)] +    print((min(D)[1]))