#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n, a[200001], ans = 0, sum;
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n - 1; i++) {
    sum = a[i];
    if (sum == 0) ans++;
    for (long long j = i + 1; j < n; j++) {
      sum += a[j];
      if (sum == 0) ans++;
    }
  }
  if (a[n - 1] == 0) ans++;
  cout << ans << "\n";
  return 0;
}
