use std::cmp;

fn main() {
    let n: usize = read();
    let list: Vec<i32> = read_vec();

    let mut r = 0;

    let mut vec = list.iter().scan(0, |state, &x| {
        *state = *state + x;
        Some(*state)
    })
    .collect::<Vec<i32>>();

    for b in &vec {if *b == 0 {r += 1};}

    for i in list {
        vec.remove(0);
        vec = vec.iter().map(|x| {x - i}).collect();
        for b in &vec {if *b == 0 {r += 1};}
    }
    println!("{}", r);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}