#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vint = vector<int>;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, count = 0;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    int sum = a[i];
    for (int j = i + 1; j < n; j++) {
      sum += a[j];
      if (sum == 0) {
        count++;
      }
    }
  }
  cout << count << "\n";
  return 0;
}
