#include <bits/stdc++.h>
using namespace std;
long long sum[1000001];
long long partsum(long long a, long long b) {
  if (a > b) swap(a, b);
  if (a == 0) return sum[b];
  return (sum[b] - sum[a - 1]);
}
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  for (signed i = 0; i < n; ++i) cin >> a[i];
  long long res = 0;
  sum[0] = a[0];
  for (long long i = 1; i < n; ++i) {
    sum[i] = sum[i - 1] + a[i];
  }
  for (signed i = 0; i < n; ++i)
    for (long long j = i; j < n; ++j)
      if (partsum(i, j) == 0) res++;
  cout << res;
  return 0;
}
