#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
long long n, a[200010], ans = 0, sum = 0;
vector<vector<bool>> flag(200010, vector<bool>(200010, 0));
void f(long long l, long long r, long long sum) {
  if (l > r) return;
  if (flag[l][r]) return;
  flag[l][r] = 1;
  if (!sum) ans++;
  f(l + 1, r, sum - a[l]);
  f(l, r - 1, sum - a[r]);
}
void solve() {
  cin >> n;
  for (int64_t i = (0); i < (n); i++) {
    cin >> a[i];
    sum += a[i];
  }
  f(0, n - 1, sum);
  cout << ans << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
