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