#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  int ans = 0;
  for (int i = 0; i < a.size(); i++) {
    int tmpsum = a[i];
    for (int j = i + 1; j < a.size(); j++) {
      tmpsum += a[j];
      if (tmpsum == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
