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