#include <bits/stdc++.h>
int main(int argc, char const *argv[]) {
  int n, a[200001], i, j, c, sum;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = 0; i < n; i++) {
    sum = 0;
    for (j = i; j < n; j++) {
      sum += a[j];
      if (sum == 0) c++;
    }
  }
  printf("%d\n", c);
  return 0;
}
