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