#include <bits/stdc++.h>
int main(void) {
  long int n;
  long long int a[200005] = {};
  scanf("%ld", &n);
  for (long int p = 0; p < n; p++) scanf("%lld ", &a[p]);
  long int ans = 0;
  for (long int q = 0; q < n; q++) {
    if (a[q] == 0) ans++;
    for (long int r = q + 1; r < n; r++) {
      a[q] += a[r];
      if (a[q] == 0) ans++;
    }
  }
  printf("%ld", ans);
}
