#include <bits/stdc++.h>
using namespace std;
int n;
int a[111111];
map<int, int> cnt;
int main() {
  scanf("%d", &n);
  for (int(i) = 0; (i) < (n); ++(i)) {
    int first;
    scanf("%d", &first);
    if (i)
      a[i] = a[i - 1] + first;
    else
      a[i] = first;
  }
  cnt[a[0]] = 1;
  long long ans = 0;
  for (int i = 1; i < n - 1; ++i) {
    if (a[i] == (a[n - 1] - a[i]) * 2) ans += cnt[a[i] / 2];
    cnt[a[i]]++;
  }
  cout << ans << endl;
}
