#include <bits/stdc++.h>
int main() {
  int n, i, j, sum, subSequences = 0;
  std::cin >> n;
  int a[n];
  for (i = 0; i < n; i++) std::cin >> a[i];
  for (i = 0; i < n; i++) {
    sum = 0;
    for (j = i; j < n; j++) {
      sum += a[j];
      if (sum == 0) subSequences += 1;
    }
  }
  std::cout << subSequences << std::endl;
  return 0;
}
