#include <bits/stdc++.h>
using namespace std;
template <typename T>
void printmatrix(vector<vector<T> > ar) {
  for (int i = 0; i < (int)ar.size(); i++) {
    for (int j = 0; j < (int)ar.size(); j++) {
      cout << ar[i][j];
    }
    cout << endl;
  }
}
template <typename T>
void printvector(vector<T> vec) {
  for (int i = 0; i < (int)vec.size(); i++) {
    cout << vec[i] << endl;
  }
}
template <typename T>
void unique(vector<T>& vec) {
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
}
template <typename T>
vector<T> cumsum(vector<T> vec) {
  vector<T> newvec((T)vec.size());
  int tmp = 0;
  for (int i = 0; i < (int)vec.size(); i++) {
    tmp += vec[i];
    newvec[i] = tmp;
  }
  return newvec;
}
int main(int argc, char const* argv[]) {
  int n;
  cin >> n;
  vector<long long> A(n);
  for (long long i = 0; i < n; i++) {
    cin >> A[i];
  }
  long long count = 0;
  for (long long i = 0; i < n; i++) {
    int sum = A[i];
    if (A[i] == 0) {
      count++;
    }
    for (long long j = i + 1; j < n; j++) {
      sum += A[j];
      if (sum == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
  return 0;
}
