#include <bits/stdc++.h>
using namespace std;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INF = 1000000007;
const int mod = 1000000007;
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  int n;
  int cnt = 0;
  cin >> n;
  vector<long long> ruiseki(n + 2);
  cin >> ruiseki[1];
  int a;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < i; j++) {
      if (ruiseki[i] == ruiseki[j]) {
        cnt++;
      }
    }
    cin >> a;
    ruiseki[i + 1] = ruiseki[i] + a;
  }
  for (int j = 0; j < n; j++) {
    if (ruiseki[n] == ruiseki[j]) {
      cnt++;
    }
  }
  cout << cnt << endl;
}
