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