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