#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  vector<ll> sum(N + 1);
  sum[0] = 0;
  for (int i = 1; i < N + 1; i++) {
    sum[i] += sum[i - 1] + A[i - 1];
  }
  ll ans = 0;
  for (int i = 0; i <= N; i++) {
    for (int j = i + 1; j <= N; j++) {
      if (sum[j] - sum[i] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
