using System;
class Program
{
	static void Main(string[] args)
	{
		string t = Console.ReadLine();
		int N = int.Parse(t);
		string[] s = Console.ReadLine().Split(' ');
		int [] A = new int[N];
		for(var i=0;i<N;i++){
			A[i] = int.Parse(s[i]);
		}
		int count = 0;
		for(var i=0;i<N;i++){
			int sum = 0;
			for(var j=i;j<N;j++){
				sum += A[j];
				if(sum == 0){
					count += 1;
				}
			}
		}
		Console.WriteLine(count);
	}
}