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