#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A;
  for (int i = 0; i < N; i++) {
    int ipst;
    cin >> ipst;
    A.push_back(ipst);
  }
  long long cns = 0;
  for (int i = 0; i < N; i++) {
    long long su = 0;
    for (int j = i; j < N; j++) {
      su += A[j];
      if (su == 0) cns++;
    }
  }
  cout << (cns) << endl;
  return 0;
}
