#include <bits/stdc++.h>
using namespace std;
int a[100010];
int main() {
  int n, he = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    he += a[i];
  }
  if (he % 3 != 0) {
    cout << "0" << endl;
    return 0;
  }
  he /= 3;
  long long x = 0, y = 0, z = 0;
  for (int i = 1; i < n; i++) {
    x += a[i];
    if (x == 2 * he) z += y;
    if (x == he) ++y;
  }
  cout << z << endl;
  return 0;
}
