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