#include <bits/stdc++.h>
int a, b[200005];
int main() {
  int n, i, j, sum, t;
  scanf("%d", &n);
  sum = t = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &a);
    sum += a;
    b[i] = sum;
    if (sum == 0) t++;
  }
  for (i = 0; i < n; i++)
    for (j = 0; j < i; j++)
      if (b[i] - b[j] == 0) t++;
  printf("%d\n", t);
}
