#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long MAX = 100005;
const long long MOD = 1000000007;
template <typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) {
  return s << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1) s << "	";
  }
  return s;
}
template <typename T>
ostream &operator<<(ostream &s, const vector<vector<T>> &vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> v(n);
  vector<long long> sm(n);
  for (long long i = (0); i < (n); i++) {
    cin >> v[i];
  }
  for (long long i = (0); i < (n); i++) {
    if (i == 0) {
      sm[i] = v[i];
      continue;
    }
    sm[i] = sm[i - 1] + v[i];
  }
  long long ans = 0;
  for (long long i = (0); i < (n); i++) {
    for (long long j = (i + 1); j < (n); j++) {
      if (i == 0) {
        if (sm[j] == 0) {
          ans++;
          continue;
        }
      }
      if (sm[j] - sm[i - 1] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
