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