#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vs = vector<string>;
signed main() {
  int n;
  scanf("%d", &n);
  vi a(n);
  for (auto&& e : a) scanf("%d", &e);
  vi sum(n);
  int cnt = 0;
  sum[0] = a[0];
  for (ll i = (1); i < (ll)(n); ++i) {
    sum[i] = sum[i - 1] + a[i];
  }
  for (ll i = (0); i < (ll)(n); ++i) {
    for (ll j = (i + 1); j < (ll)(n + 1); ++j) {
      if (sum[j] - sum[i] == 0) cnt++;
    }
  }
  printf("%d\n", cnt);
  return 0;
}
