#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  auto a = new int[n];
  for (size_t i = 0; i < n; i++) {
    cin >> a[i];
  }
  int count = 0;
  auto q = queue<int>();
  for (size_t i = 0; i < n; i++) {
    int f = q.size();
    for (size_t j = 0; j < f; j++) {
      long e = q.front();
      q.pop();
      if (e == 0) {
        ++count;
      }
      q.emplace(e + a[i]);
    }
    q.push(a[i]);
  }
  int c = q.size();
  for (size_t i = 0; i < c; ++i) {
    long long e = q.front();
    q.pop();
    if (e == 0) {
      ++count;
    }
  }
  cout << count << endl;
  return 0;
}
