#!/usr/bin/env python3

from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    ave = sum(a) / n
    ans = 0
    for i in range(n):
        ai = a[i]
        if abs(ai - ave) < abs(a[ans] - ave):
            ans = i
    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

2d750401cc83259e95854c43908850c3337026b2
<mask token>

<mask token>


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    ave = sum(a) / n
    ans = 0
    for i in range(n):
        ai = a[i]
        if abs(ai - ave) < abs(a[ans] - ave):
            ans = i
    print(ans)


<mask token>

<mask token>


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    ave = sum(a) / n
    ans = 0
    for i in range(n):
        ai = a[i]
        if abs(ai - ave) < abs(a[ans] - ave):
            ans = i
    print(ans)


if __name__ == '__main__':
    setrecursionlimit(10000)
    main()

from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    ave = sum(a) / n
    ans = 0
    for i in range(n):
        ai = a[i]
        if abs(ai - ave) < abs(a[ans] - ave):
            ans = i
    print(ans)


if __name__ == '__main__':
    setrecursionlimit(10000)
    main()

#!/usr/bin/env python3

from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    ave = sum(a) / n
    ans = 0
    for i in range(n):
        ai = a[i]
        if abs(ai - ave) < abs(a[ans] - ave):
            ans = i
    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
