#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using vi = vector<long long>;
using pint = pair<long long, long long>;
const long long INF = 1LL << 55;
long long n;
long long a;
vi vec;
long long sum;
long long ans = 0;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> a;
    vec.push_back(a);
  }
  for (long long i = 0; i < n; ++i) {
    sum = 0;
    for (long long j = i; j < n; ++j) {
      sum += vec[j];
      if (sum == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
