#include <bits/stdc++.h>
using namespace std;
static const int giga = pow(10, 9);
int main(void) {
  int n;
  cin >> n;
  vector<long long int> a(n);
  for (int i = 0; i < n; i++) {
    long long int temp;
    cin >> temp;
    a[i] = temp;
  }
  long long int ans = 0;
  for (int begin = 0; begin < n; begin++) {
    long long int sum = 0;
    for (int i = begin; i < n; i++) {
      sum += a[i];
      if (sum == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
