#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const double PI = 2 * acos(0.0);
const double EPS = 1e-8;
const int INF = 1000000000;
int n;
int s, ss;
long long ans;
int x[100000], d[100001];
int main() {
  scanf("%d", &n);
  for (int i = (int)(0); i < (int)(n); ++i) scanf("%d", &x[i]);
  for (int i = (int)(0); i < (int)(n); ++i) s += x[i];
  if ((s % 3) != 0) {
    printf("0");
    return 0;
  };
  s /= 3;
  ss = 3 * s;
  d[n] = 0;
  for (int i = n - 1; i; --i) {
    if (i < n - 1 && ss == 2 * s)
      d[i] = d[i + 1] + 1;
    else
      d[i] = d[i + 1];
    ss -= x[i];
  };
  ss = 0;
  for (int i = (int)(0); i < (int)(n - 1); ++i) {
    if (ss == s) ans += d[i];
    ss += x[i];
  };
  cout << ans;
  return 0;
};
