#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> sum(n, 0);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j < i + 1; j++) {
      sum[j] += a[i];
      if (sum[j] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
