#include <iostream>
#include <cstdlib>
#include <vector>
#include <numeric>

int main()
{
    int N;
    std::vector<int> A;
    
    std::cin >> N;
    
    int a;
    while(std::cin >> a)
        A.push_back(a);
    
    int c = 0;
    const int length = A.size();
    for(int pos = 0; pos < length; pos++) {
        for(int size = 1; size <= length - pos; size++) {
            const auto first = std::cbegin(A) + pos;
            if(!std::accumulate(first, first + size, 0))
                c++;
        }
    }       
    
    std::cout << c << std::endl;
}