use std::io::*;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let a: Vec<i64> = (0..n).map(|_| read::<i64>()).collect();
    let mut sum: i64 = 0;
    for i in 0..n {
        sum += a[i];
    }
    let ave = sum / (n as i64);
    let mut dis = 1 << 31;
    let mut ans = 0;
    for i in 0..n {
        let mut d = ave - a[i];
        if d < 0 {
            d = -d;
        }
        if d < dis {
            dis = d;
            ans = i;
        }
    }
    println!("{}", ans);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
