#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> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long> ruiseki(n + 1);
  for (int i = 0; i < n; i++) {
    ruiseki[i + 1] = ruiseki[i] + a[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j <= n; j++)
      if (ruiseki[i] == ruiseki[j]) {
        cnt++;
      }
  }
  cout << cnt << endl;
}
