#include <bits/stdc++.h>
int main() {
  int i, j, sum = 0, M = 0, N;
  int *X;
  scanf("%d", &N);
  X = (int *)malloc(N * sizeof(int));
  for (i = 0; i < N; i++) {
    scanf("%d", &X[i]);
  }
  for (i = 0; i < N; i++) {
    sum += X[i];
    for (j = i + 1; j < N; j++) {
      sum += X[j];
      if (sum == 0) M++;
    }
    sum = 0;
  }
  printf("%d\n", M);
  return 0;
}
