#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  int num[200001];
  long long qSum[200001] = {0};
  int sum = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> num[i];
    qSum[i] = qSum[i - 1] + num[i];
  }
  for (int i = 1; i <= n; ++i) {
    if (qSum[i] == 0) {
      sum++;
    }
    for (int j = i + 1; j <= n; ++j) {
      if (qSum[i] == qSum[j]) {
        sum++;
      }
    }
  }
  cout << sum << endl;
  return 0;
}
