#include <bits/stdc++.h>
int main(void) {
  int N;
  scanf("%d", &N);
  int num[N];
  int i;
  for (i = 0; i < N; i++) {
    scanf("%d", &(num[i]));
  }
  int sum = 0;
  int k, l;
  int count = 0;
  for (k = 0; k < N; k++) {
    sum = num[k];
    for (l = 1; l < N; l++) {
      sum += num[l];
      if (sum == 0) {
        count++;
      }
    }
  }
  printf("%d", count);
  return 0;
}
