#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int v[MAXN], s[MAXN];
int calc_sum(int a, int b) { return s[b] - s[a - 1]; }
map<int, int> dp;
int main() {
  int n;
  scanf("%d", &n);
  v[0] = 0;
  s[0] = 0;
  int tot = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &v[i]);
    s[i] = v[i] + s[i - 1];
    tot += v[i];
  }
  int current = 0;
  long long sols = 0;
  for (int i = 1; i <= n - 1; i++) {
    current += v[i];
    if (current % 2 != 0) {
      dp[current]++;
      continue;
    }
    if (tot - current / 2 == current) {
      sols += dp[current / 2];
    }
    dp[current]++;
  }
  cout << sols << "\n";
  return 0;
}
