#include <bits/stdc++.h>
using ll = long long;
void solve() {
  using namespace std;
  int n;
  cin >> n;
  vector<ll> v(n);
  for (auto& x : v) cin >> x;
  ll count{};
  for (int i = 0; i < n; ++i) {
    auto sum = v[i];
    if (sum == 0) ++count;
    for (int j = i + 1; j < n; ++j) {
      sum += v[j];
      if (sum == 0) ++count;
    }
  }
  cout << count << endl;
}
int main() {
  solve();
  return 0;
}
