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