#include <bits/stdc++.h>
int main() {
  int N;
  scanf("%d", &N);
  int* A = new int[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  int res = 0;
  for (int i = 0; i < N; i++) {
    int tmp = 0;
    for (int t = i; t < N; t++) {
      tmp += A[t];
      if (tmp == 0) {
        res++;
      }
    }
  }
  printf("%d\n", res);
  return 0;
}
