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