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