#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vint = vector<int>;
using pint = pair<int, int>;
const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();
void solve() {
  int N;
  cin >> N;
  int a[2 * 100000 + 5], sum[2 * 100000 + 5];
  for (int i = 0; i < int(N); ++i) cin >> a[i];
  int s = 0;
  for (int i = 0; i < int(N); ++i) {
    s += a[i];
    sum[i] = s;
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      if (i - 1 == -1 && sum[j] == 0) {
        ans++;
        continue;
      }
      if (sum[j] - sum[i - 1] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
