#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(int argc, const char* argv[]) {
  ll n, a;
  cin >> n;
  vector<ll> v(n), s(n);
  for (ll i = 0; i < n; i++) {
    cin >> a;
    v[i] = a;
    if (i == 0) {
      s[0] = v[0];
    } else {
      s[i] += s[i - 1] + v[i];
    }
  }
  ll cnt = 0;
  for (ll i = 0; i < n; i++) {
    s[i] = v[i];
    if (s[i] == 0) {
      cnt++;
    }
    for (ll j = i + 1; j < n; j++) {
      if (i == 0) {
        if (s[j] == 0) {
          cnt++;
        }
      } else {
        if (s[j] - s[i - 1] == 0) {
          cnt++;
        }
        s[j] = s[j] - s[i - 1];
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
