#include <bits/stdc++.h>
using namespace std;
const int MAX = 510000;
const int INF = 2000000000;
const int MOD = 1000000007;
long long gcd(long long a, long long b) {
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int pow_kai(int a, int n) {
  int x = 1;
  while (n > 0) {
    if (n & 1) {
      x = x * a;
    }
    a = a * a;
    n >>= 1;
  }
  return x;
}
long long modPow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long modInv(long long a, long long mod) { return modPow(a, mod - 2, mod); }
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
bool isPrime(long long x) {
  int i;
  if (x < 2)
    return false;
  else if (x == 2)
    return true;
  if (x % 2 == 0) return false;
  for (i = 3; i * i <= x; i += 2)
    if (x % i == 0) return false;
  return true;
}
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int cnt = 0;
  for (int l = 0; l < n; l++) {
    int sum = a[l];
    for (int r = l + 1; r < n; r++) {
      sum += a[r];
      if (sum == 0) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}
