#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const string SPACE = " ";
long long powsur(long long a, long long b, long long p) {
  if (b == 0) {
    return 1;
  } else if (b % 2 == 0) {
    long long d = powsur(a, b / 2, p);
    return ((d % p) * (d % p)) % p;
  } else {
    return ((a % p) * powsur(a, b - 1, p) % p) % p;
  }
}
long long CMOD(long long n, long long r, long long p) {
  long long a = 1, b = 1, c = 1, re;
  for (int i = 1; i <= n; i++) {
    a *= i;
    a = a % p;
  }
  for (int i = 1; i <= r; i++) {
    b *= i;
    b = b % p;
  }
  for (int i = 1; i <= n - r; i++) {
    c *= i;
    c = c % p;
  }
  b = powsur(b, p - 2, p);
  c = powsur(c, p - 2, p);
  re = ((a % p) * (b % p)) % p;
  re = ((re % p) * c % p) % p;
  return re;
}
long long gcd(long long a, long long b) {
  if (a > b) {
    long long tmp = a;
    a = b;
    b = tmp;
  }
  long long r;
  r = b % a;
  if (r == 0)
    return a;
  else
    return gcd(r, a);
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long MAX(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long MIN(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
bool p_judge(long long p) {
  if (p == 1)
    return false;
  else if (p == 2)
    return true;
  else {
    bool flag = true;
    for (int i = 2; i <= sqrt(p); i++) {
      if (p % i == 0) {
        flag = false;
        break;
      }
    }
    return flag;
  }
}
int main() {
  int N;
  vector<long long> V;
  V.push_back(0);
  cin >> N;
  for (int i = 0; i < N; i++) {
    long long tmp;
    cin >> tmp;
    V.push_back(V[V.size() - 1] + tmp);
  }
  long long cnt = 0;
  for (int l = 0; l <= N - 1; l++) {
    for (int r = l + 1; r <= N; r++) {
      if (V[r] - V[l] == 0) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
