#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  long long acc[200010];
  int ans;
  cin >> n;
  acc[0] = 0;
  for (int i = 1; i <= n; i++) {
    int t;
    cin >> t;
    acc[i] = acc[i - 1] + t;
  }
  cout << endl;
  ans = 0;
  for (int rng = 1; rng <= n; rng++) {
    for (int i = 1; i + rng - 1 <= n; i++) {
      if (acc[i + rng - 1] - acc[i - 1] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
