using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace AGC23
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            var a = ReadLine().Split().Select(long.Parse).ToArray();
            var sub = new Queue<long>();
            int count = 0;
            for (int i = 0; i < n; i++)
            {
                int f = sub.Count;
                for (int j = 0; j < f; j++)
                {
                    long e = sub.Dequeue();
                    if (e == 0)
                    {
                        count++;
                    }
                    sub.Enqueue(e + a[i]);
                }
                sub.Enqueue(a[i]);
            }
            int c = sub.Count;
            for (int i = 0; i < c; i++)
            {
                long e = sub.Dequeue();
                if (e == 0)
                {
                    count++;
                }
            }
            WriteLine(count);
        }
    }
}
