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