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