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