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