#include <bits/stdc++.h>
using namespace std;
int a[100001], n;
int main() {
  ifstream f("f.in");
  int n, sum = 0, d = 0, i;
  long long total = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
    a[i] += a[i - 1];
  }
  if (sum % 3 == 0) {
    sum /= 3;
    if (a[0] == sum)
      d = 1;
    else
      d = 0;
    for (i = 1; i < n - 1; i++) {
      if (a[i] == sum * 2) total += d;
      if (a[i] == sum) ++d;
    }
  }
  cout << total;
  return 0;
}
