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