#include <bits/stdc++.h>
using namespace std;
int main() {
  int sum = 0, s = 0, n, num = 0, x, i = 0, j = 0, *a;
  cin >> n;
  a = new int[n];
  while (i < n) {
    cin >> x;
    sum += x;
    a[i] = x;
    num = (sum == 0) ? num + 1 : num;
    i++;
  }
  sum -= a[0];
  s = sum;
  while (j < n) {
    i = 1;
    while (i < n - j) {
      num = (sum == 0) ? num + 1 : num;
      sum -= a[i];
      i++;
    }
    s -= a[n - 1 - j];
    sum = s;
    j++;
  }
  cout << num;
  return 0;
}
