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