#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  long long ans = 0;
  for (long long i = 1; i < n + 1; i++) {
    for (long long j = 0; j < n - i + 1; j++) {
      long long sum = 0;
      for (long long k = j; k < j + i; k++) {
        sum += v[k];
      }
      if (sum == 0) ans++;
    }
  }
  cout << ans << endl;
}
