#include <bits/stdc++.h>
using namespace std;
template <class T>
void cou(vector<vector<T>> a) {
  long long b = a.size();
  long long c = a[0].size();
  for (long long i = 0; i < b; i++) {
    for (long long j = 0; j < c; j++) {
      cout << a[i][j];
      if (j == c - 1)
        cout << endl;
      else
        cout << ' ';
    }
  }
}
long long wari(long long a, long long b) {
  if (a % b == 0)
    return a / b;
  else
    return a / b + 1;
}
long long keta(long long a) {
  double b = a;
  b = log10(b);
  long long c = b;
  return c + 1;
}
long long souwa(long long a) { return a * (a + 1) / 2; }
long long gcm(long long a, long long b) {
  long long d = a, e = b, f;
  if (a < b) swap(a, b);
  long long c, m = 1;
  while (m) {
    c = a % b;
    if (c == 0) {
      f = b;
      m--;
    } else {
      a = b;
      b = c;
    }
  }
  return f;
}
bool prime(const unsigned long long n) {
  switch (n) {
    case 0:
    case 1:
      return false;
    case 2:
    case 3:
      return true;
  }
  if (n % 2 == 0) return false;
  if (n % 3 == 0) return false;
  if (n % 6 != 1 && n % 6 != 5) return false;
  for (unsigned long long i = 5; i * i <= n; i += 6) {
    if (n % i == 0) return false;
    if (n % (i + 2) == 0) return false;
  }
  return true;
}
struct Union {
  vector<long long> par;
  Union(long long a) { par = vector<long long>(a, -1); }
  long long find(long long a) {
    if (par[a] < 0)
      return a;
    else
      return par[a] = find(par[a]);
  }
  bool same(long long a, long long b) { return find(a) == find(b); }
  long long Size(long long a) { return -par[find(a)]; }
  void unite(long long a, long long b) {
    a = find(a);
    b = find(b);
    if (a == b) return;
    if (Size(b) > Size(a)) swap<long long>(a, b);
    par[a] += par[b];
    par[b] = a;
  }
};
long long ketas(long long a) {
  string b = to_string(a);
  long long c = 0;
  for (long long i = 0; i < keta(a); i++) {
    c += b[i] - '0';
  }
  return c;
}
long long lcm(long long a, long long b) { return a / gcm(a, b) * b; }
bool fe(long long a, long long b) {
  a %= 10;
  b %= 10;
  if (a == 0) a = 10;
  if (b == 0) b = 10;
  if (a > b)
    return true;
  else
    return false;
}
long long INF = 1000000007;
struct edge {
  long long s, t, d;
};
signed main() {
  long long a;
  cin >> a;
  vector<long long> b(a);
  for (long long i = 0; i < a; i++) cin >> b[i];
  vector<long long> c(a);
  c[0] = b[0];
  for (long long i = 0; i < a - 1; i++) c[i + 1] = c[i] + b[i + 1];
  long long d = 0;
  for (long long i = 0; i < a; i++) {
    for (long long j = i + 1; j < a; j++) {
      if (c[j] - c[i] == 0) d++;
    }
  }
  cout << d << endl;
}
