#include <bits/stdc++.h>
using ul = uint64_t;
using ll = int64_t;
using namespace std;
int main() {
  (ios::sync_with_stdio(false), cin.tie(0), cout.tie(0));
  int n;
  cin >> n;
  vector<ll> sum(n + 1);
  sum.at(0) = 0;
  ll current_sum = 0;
  for (int i = 0; i < n; i++) {
    ll input;
    cin >> input;
    current_sum += input;
    sum.at(i + 1) = current_sum;
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (sum.at(j) - sum.at(i) == 0) cnt++;
    }
  }
  cout << cnt << endl;
}
