#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  vector<int> v(n + 1);
  for (int i = 0; i < (int)(n); i++) {
    v[i + 1] = v[i] + a[i];
  }
  int ans = 0;
  for (int l = 0; l < n; l++) {
    for (int r = l + 1; r < n + 1; r++) {
      if (v[r] - v[l] == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
