    using System;
    using System.Collections.Generic;
    using static System.Console;
    using System.Linq;


class Program
{
    static void Main(string[] Args) {
        ReadLine();
        var A_ = new List<string>(ReadLine().Split(' ')).Select(ele => Int32.Parse(ele)).ToList();
        var A = new List<int>();
        A.Add(0);
        int Sum = 0;
        foreach(int e in A_) {
            Sum += e;
            A.Add(Sum);
        }

        int Result = 0;

        for(int i = 0;i < A.Count() - 1;i++)
            for(int j = i + 1;j < A.Count(); j++) {
                if (A[j] - A[i] == 0) Result++;
            }

        WriteLine(Result);

        ReadLine();
    }
}