#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll n;
ll a[100000];
ll b[100000];
int main(void) {
  cin >> n;
  int t, sum = 0;
  int res = 0, cnt = 0;
  for (ll i = 0; i < (int)(n); i++) {
    cin >> t;
    a[i] = t;
    b[i] = t;
    if (i) b[i] += b[i - 1];
  }
  for (ll i = 0; i < (int)(n); i++) {
    for (int j = i; j < n; j++) {
      sum = 0;
      for (int k = i; k <= j; k++) sum += a[k];
      if (sum == 0) res++;
    }
  }
  cout << res << endl;
}
