#include <bits/stdc++.h>
using namespace std;
int A[200000];
int minians = 0;
int n;
int i = 0, j = 0;
int saiki(int sum, int i) {
  if (i >= n - 1) {
    return 0;
  } else if (!(sum + A[i])) {
    minians++;
    saiki(sum + A[i], i + 1);
  }
  saiki(A[i], i + 1);
}
int main() {
  cin >> n;
  for (i = 0; i <= n - 1; i++) cin >> A[i];
  saiki(0, 0);
  cout << minians << endl;
}
