#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);
  long long int n, count = 0, sum = 0, sumb;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
    if (sum == 0) {
      count++;
    }
    sumb = sum;
    for (int j = 0; j < i; j++) {
      sumb -= a[j];
      if (sumb == 0) {
        count++;
      }
    }
  }
  cout << count << "\n";
  return 0;
}
