#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  std::cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
  }
  int count = 0;
  for (int s = 0; s < n; s++) {
    int sum = 0;
    for (int e = s; e < n; e++) {
      sum += a[e];
      if (sum == 0) {
        count++;
      }
    }
  }
  std::cout << count << std::endl;
}
