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