#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  ll i, j, k;
  ll ans = 0;
  for (i = 0; i < n; i++) cin >> a.at(i);
  for (i = 1; i <= n; i++) {
    for (j = 0; j < n - i + 1; j++) {
      ll sum = 0;
      for (k = j; k < j + i; k++) {
        sum += a.at(k);
      }
      if (sum == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
