#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0;
  cin >> n;
  vector<int> a(n);
  int ans = 0;
  for (int i = 0; i < n; ++i) cin >> a.at(i);
  for (int i = 0; i < n - 1; ++i) {
    int sum = a.at(i);
    for (int j = i + 1; j < n; ++j) {
      sum += a.at(j);
      if (sum == 0) ++ans;
    }
  }
  cout << ans << endl;
}
