#[derive(Debug, PartialEq)]
struct Frame {
    index: usize,
    value: i32,
}
#[cfg(test)]
mod tests;

fn main() {
    let n = read_usize();
    let v = read_line_vec(Some(n));
    let mut frames = parse_frame(v);
    let ave = frames.iter().fold(0, |a, b| a + b.value) as f64 / n as f64;
    frames.sort_by_key(|a| -a.value);
    let ans: Vec<Frame> = frames.into_iter().filter(|a| (a.value as f64) <= ave).collect();

    println!("{}", ans[0].index);
}

fn parse_frame(v: Vec<String>) -> Vec<Frame> {
    let mut ans = Vec::with_capacity(v.len());
    for (i, e) in v.into_iter().enumerate() {
        ans.push(Frame {
            index: i,
            value: e.parse().unwrap(),
        });
    }
    ans
}

fn read_usize() -> usize {
    let handle = std::io::stdin();
    let mut buf = String::new();
    handle.read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

fn read_line_vec(cap: Option<usize>) -> Vec<String> {
    let handle = std::io::stdin();
    let mut buf = String::new();
    handle.read_line(&mut buf).unwrap();
    match cap {
        Some(n) => {
            let mut v: Vec<String> = Vec::with_capacity(n);
            v = buf
                .trim()
                .split_whitespace()
                .map(|a| a.parse().unwrap())
                .collect();
            v
        }
        None => buf
            .trim()
            .split_whitespace()
            .map(|a| a.parse().unwrap())
            .collect(),
    }
}
