#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
signed main() {
  long long a;
  cin >> a;
  vector<long long> b(a);
  for (long long i = 0; i < a; i++) cin >> b[i];
  long long c[a + 100];
  c[0] = 0;
  for (long long i = 1; i <= a; i++) c[i] = b[i - 1] + c[i - 1];
  long long d = 0;
  for (long long i = 0; i < a + 1; i++)
    for (long long j = 0; j < a + 1; j++) {
      if (c[i] == c[j]) d++;
    }
  cout << d / 2 << endl;
}
