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