#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<long long, long long>;
template <class T>
using vec = vector<T>;
std::string strMulti(std::string t, int n) {
  std::string out = "";
  for (int i = 0; i < n; i++) {
    out += t;
  }
  return out;
}
template <class T>
void _debug_coutvec(vector<T> ar, string space = " ") {
  for (int i = 0, i_len = (ar.size()); i < i_len; ++i) {
    (std::cerr << ar[i] << space);
  }
  (std::cerr << ""
             << "\n");
}
template <class T1, class T2>
void _debug_coutvec(vector<pair<T1, T2>> ar, string space = " ") {
  for (int i = 0, i_len = (ar.size()); i < i_len; ++i) {
    (std::cerr << ar[i].first << "," << ar[i].second << space);
  }
  (std::cerr << ""
             << "\n");
}
constexpr int INF = 2000000000;
constexpr ll INFL = 1ll << 60ll;
template <class T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
T divup(T a, T b) {
  if (a % b == 0) {
    return a / b;
  }
  return a / b + 1;
}
template <class T>
bool cmp_2nd(pair<T, T> a, pair<T, T> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  }
  return a.first < b.first;
}
ll mod_pow(ll x, ll n, const ll& p) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) {
      (ret *= x) %= p;
    }
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
template <class T>
T modinv(T a, const T& p) {
  T b = p, u = 1, v = 0;
  while (b) {
    T t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= p;
  if (u < 0) {
    u += p;
  }
  return u;
}
template <class T>
T math_P(T m, T n) {
  T ret = 1;
  for (T i = m; i > m - n; i--) {
    ret *= i;
  }
  return ret;
}
template <class T>
T math_C(T m, T n) {
  T ret = math_P(m, n);
  for (T i = 2; i <= n; i++) {
    ret /= i;
  }
  return ret;
}
ll math_P_mod(ll m, ll n, const ll& p) {
  ll ret = 1;
  for (ll i = m; i > m - n; i--) {
    ret = (ret * i) % p;
  }
  return ret;
}
ll math_C_mod(ll m, ll n, const ll& p) {
  ll ret = math_P_mod(m, n, p);
  ll div = 1;
  for (ll i = 2; i <= n; i++) {
    div = (div * i) % p;
  }
  ret = (ret * modinv(div, p)) % p;
  return ret;
}
template <class T>
T math_gcd(T a, T b) {
  if (b == 0) {
    return a;
  } else {
    return math_gcd(b, a % b);
  }
}
constexpr ll MOD = 1000000007;
void Main() {
  int N;
  cin >> N;
  vec<ll> A(N), Sum(N + 1);
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    cin >> A[i];
    Sum[i + 1] = Sum[i] + A[i];
  }
  ll ret = 0;
  for (int i = (0), i_len = (N + 1); i < i_len; ++i) {
    for (int j = (i + 1), j_len = (N + 1); j < j_len; ++j) {
      if (Sum[i] - Sum[j] == 0) {
        ret++;
      }
    }
  }
  cout << ret;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  Main();
  std::cerr << flush;
  cout << endl;
  return 0;
}
