#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
vector<ll> A(200000), sum(200000);
int main() {
  ll N, ans = 0;
  cin >> N;
  for (int i = 0; i < (N); i++) {
    cin >> A[i];
  }
  sum[0] = A[0];
  for (int i = 1; i < N; i++) {
    sum[i] = sum[i - 1] + A[i];
  }
  for (int i = 0; i < (N); i++) {
    if (sum[i] == 0) ans++;
  }
  for (int i = 0; i < (N - 1); i++) {
    for (int j = i + 1; j < N; j++) {
      if (sum[j] - sum[i] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
