#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> A;
  A.push_back(0);
  long long sum = 0;
  long long ret = 0;
  for (long long i = 0; i < N; i++) {
    long long in;
    cin >> in;
    sum += in;
    vector<long long>::iterator it = A.begin();
    while ((it = find(it, A.end(), sum)) != A.end()) {
      ret++;
      it++;
    }
    A.push_back(sum);
  }
  cout << ret << endl;
  return 0;
}
