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