#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 200000 + 5;
long long a[maxn];
int main() {
  int n;
  cin >> n;
  int s = 0, cnt = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    a[i] += a[i - 1];
  }
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++) {
      if (a[j] - a[i - 1] == 0) cnt++;
    }
  printf("%d\n", cnt);
  return 0;
}
