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