#include <bits/stdc++.h>
using namespace std;
long long A[200005];
int N;
int dfs(int idx, long long sum, bool selected) {
  if (idx == N) return (sum == 0 && selected ? 1 : 0);
  if (selected) {
    if (sum == 0) {
      return (1 + dfs(idx + 1, sum + A[idx], true));
    } else {
      return dfs(idx + 1, sum + A[idx], true);
    }
  }
  return dfs(idx + 1, 0, false) + dfs(idx + 1, A[idx], true);
}
int main() {
  int ans = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  cout << dfs(0, 0, false) << endl;
  return 0;
}
