#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, A[199999];
  int sum, ans = 0;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < N; ++i) {
    sum = A[i];
    for (int j = i + 1; j < N; ++j) {
      sum += A[j];
      if (sum == 0) {
        ++ans;
      }
    }
  }
  cout << ans << "\n";
}
