#include <bits/stdc++.h>
int main(void) {
  int n, i, j, count = 0;
  long int ans = 0;
  long int *a;
  long int *b;
  if (scanf("%d", &n) == 1)
    ;
  a = (long int *)malloc(sizeof(long int *) * n);
  b = (long int *)malloc(sizeof(long int *) * n);
  for (i = 0; i < n; i++) {
    if (scanf("%ld", &a[i]) == 1)
      ;
    ans = a[i];
    if (i > 0) {
      for (j = i - 1; j >= 0; j--) {
        if (j == i - 1) {
          ans += a[j];
          b[j] = ans;
        } else
          ans += a[j];
        if (ans == 0) count++;
      }
    }
  }
  printf("%d\n", count);
  free(a);
  free(b);
  return 0;
}
