using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
using System.Diagnostics;
using System.Globalization;
using static System.Console;
using static System.Math;


namespace agc_23_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] input = ReadLine().Split();
            int count=0;
            double sum=0;

            for(int i=0; i<input.Length; i++)
            {
                sum += int.Parse(input[i]);
                for(int j=i+1; j<input.Length; j++)
                {
                    sum += int.Parse(input[j]);
                    if(sum == 0)
                    {
                        count++;
                    }
                }
                sum = 0;
            }
            WriteLine(count);
        }
    }
}