#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  vector<map<long long, long long>> counts(2);
  counts[0][A[0]]++;
  for (int i = 1; i < N; i++) {
    auto m = counts[i % 2];
    m.clear();
    for (auto s : counts[(i - 1) % 2]) {
      m[s.first + A[i]] += s.second;
    }
    m[A[i]]++;
  }
  cout << counts[0][0] + counts[1][0] << endl;
  return 0;
}
