#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  vector<long long> v;
  cin >> n;
  v.reserve(n);
  for (int i = 0; i < n; ++i) {
    int tmp;
    cin >> tmp;
    v.push_back(tmp);
  }
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    long long sum = 0;
    for (int j = i; j < n; ++j) {
      sum += v[j];
      if (sum == 0) ++cnt;
    }
  }
  cout << cnt << endl;
  return 0;
}
