def main():
    import numpy as np
    N = int(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()
