#include <bits/stdc++.h>
int a[100000], s[100100];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    s[i + 1] = s[i] + a[i];
  }
  int ts = s[n];
  if ((ts % 3) != 0) {
    printf("0\n");
    return 0;
  }
  long long t = 0, tn = 0;
  for (int i = 1; i < n; i++) {
    if (s[i] == (ts / 3 * 2)) tn += t;
    if (s[i] == (ts / 3)) t++;
  }
  printf("%I64d\n", tn);
}
