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