#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    dead_code
)]
//use permutohedron::LexicalPermutation as _;
use proconio::input;
//use proconio::marker::Chars;
//use proconio::marker::Usize1;
//use std::collections::HashSet;
//use std::cmp::*;
//use std::num;

fn main() {
    input! {
        n:usize,
        a:[i64;n]
    }
    let mut sum = vec![0i64; n + 1];
    for i in 0..n {
        sum[i + 1] = sum[i] + a[i];
    }
    let mut ans = 0;
    for i in 0..n {
        for j in i + 1..n + 1 {
            if sum[j] - sum[i] == 0 {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}
