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