#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int num[maxn];
map<int, int> mp;
int sum[maxn];
int main() {
  int n, i, j, k;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> num[i], sum[i] = sum[i - 1] + num[i];
  int s = 0;
  long long ans = 0;
  for (i = 1; i < n; i++) {
    int tmp = sum[n] - sum[i];
    if (sum[i] == 2 * tmp) {
      ans += mp[tmp];
    }
    mp[sum[i]]++;
  }
  printf("%I64d\n", ans);
  return 0;
}
