#include <bits/stdc++.h>
using namespace std;
void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}
void Main() {
  int n;
  _cin(n);
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  int ans = 0;
  for (int start = 0; start < n; ++start) {
    for (int goal = start; goal < n; ++goal) {
      long long sum = 0ll;
      for (int i = start; i <= goal; ++i) {
        sum += a[i];
      }
      if (sum == 0ll) ans++;
    }
  }
  cout << ans << endl;
}
int main() {
  cout << fixed << setprecision(15);
  Main();
  return 0;
}
