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