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