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