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