#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> arr(N);
  for (auto& a : arr) {
    cin >> a;
  }
  long long count = 0;
  for (int i = 0; i < N; i++) {
    long long sum = arr[i];
    for (int j = i + 1; j < N; j++) {
      sum += arr[j];
      if (sum == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
}
