#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(const T x, const T y) {
  if (!y) {
    return x;
  }
  return gcd(y, x % y);
}
template <class T>
T lcm(const T x, const T y) {
  return x / gcd(x, y) * y;
};
template <class T>
T modpow(T x, T n, const T mod) {
  T res = 1;
  while (n > 0) {
    if (n % 2) res = res * x % mod;
    x = x * x % mod;
    n /= 2;
  };
  return res;
}
template <class T>
T modinv(T x, const T mod) {
  return modpow(x, mod - 2, mod);
}
template <class T>
bool alltrue(const T &a) {
  return all_of((a).begin(), (a).end(), [](bool x) { return x; });
}
template <class T>
bool anytrue(const T &a) {
  return any_of((a).begin(), (a).end(), [](bool x) { return x; });
}
template <class T>
bool contain(const T &a, const T &b) {
  for (auto x : b) {
    if (a.find(x) == a.end()) {
      return false;
    }
  }
  return true;
}
template <class T>
bool mmax(T &m, const T q) {
  if (m < q) {
    m = q;
    return true;
  } else
    return false;
}
template <class T>
bool mmin(T &m, const T q) {
  if (m > q) {
    m = q;
    return true;
  } else
    return false;
}
template <class T>
int siz(const T &a) {
  return (int)a.size();
}
template <class T>
set<T> devisers(T n) {
  set<T> res;
  for (T i = 1; i < (T)sqrt(n) + 1; i++) {
    if (n % i == 0) {
      res.insert(i);
      res.insert(n / i);
    }
  }
  return res;
}
template <class T>
void concat(T &a, const T &b) {
  a.insert(a.end(), (b).begin(), (b).end());
}
template <class T>
void getand(const T &a, const T &b, T &c) {
  set_intersection((a).begin(), (a).end(), (b).begin(), (b).end(),
                   inserter(c, c.end()));
}
template <class T>
void getor(const T &a, const T &b, T &c) {
  set_union((a).begin(), (a).end(), (b).begin(), (b).end(),
            inserter(c, c.end()));
}
template <class T>
void getdiff(const T &a, const T &b, T &c) {
  set_difference((a).begin(), (a).end(), (b).begin(), (b).end(),
                 inserter(c, c.end()));
}
template <class T>
T deg2rad(T deg) {
  return deg * 2 * M_PI / 360;
}
template <class T>
T rad2deg(T rad) {
  return rad * 360 / (2 * M_PI);
}
const long long MOD = 1e9 + 7;
const long long MAX = 5e6;
int main() {
  int N;
  cin >> N;
  vector<int> AS(N);
  vector<int> sumAS(N + 1, 0);
  for (long long i = (long long)(0); i < (long long)(N); ++i) cin >> AS[i];
  for (long long i = (long long)(0); i < (long long)(N); ++i)
    sumAS[i + 1] = sumAS[i] + AS[i];
  long long ans = 0;
  for (long long i = (long long)(0); i < (long long)(N); ++i)
    for (long long j = (long long)(i + 1); j < (long long)(N + 1); ++j) {
      if (sumAS[j] - sumAS[i] == 0) ans += 1;
    }
  cout << ans << endl;
  return 0;
}
