#include <bits/stdc++.h>
using namespace std;
int main() {
  long N;
  cin >> N;
  vector<long> num(N);
  for (long i = 0; i < N; i++) {
    cin >> num.at(i);
  }
  long temp, cnt = 0;
  for (long i = 0; i < N; i++) {
    temp = num.at(i);
    for (long k = i + 1; k < N; k++) {
      temp += num.at(k);
      if (temp == 0) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
