package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	N := ReadInt()
	a := ReadInts(N)
	mean := Sum(a...) / N
	b := make([]int, N)
	for i := 0; i < N; i++ {
		b[i] = Abs(a[i] - mean)
	}
	best := Min(b...)
	for i := 0; i < N; i++ {
		if Abs(a[i]-mean) == best {
			fmt.Println(i)
			return
		}
	}
}

func Min(xs ...int) int {
	min := xs[0]
	for _, x := range xs[1:] {
		if min > x {
			min = x
		}
	}
	return min
}

func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func Sum(slice ...int) int {
	sum := 0
	for _, v := range slice {
		sum += v
	}
	return sum
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}
