#include <bits/stdc++.h>
int main(int argc, char const *argv[]) {
  int n;
  scanf("%d", &n);
  long long int *a = new long long int[n];
  long long int *b = new long long int[n];
  long long int count = 0;
  for (int i = 0; i < n; i++) {
    scanf("%lld", a + i);
    b[i] = 0;
    for (int j = 0; j <= i; j++) {
      b[j] += a[i];
      if (b[j] == 0) count++;
    }
  }
  printf("%lld\n", count);
  return 0;
}
