#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const bool test = true;
long long dx[] = {1, 0, -1, 0};
long long dy[] = {0, 1, 0, -1};
const long long INF = (long long)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (long long)1e9 + 7;
const double eps = 1e-10;
long long sgn(const long double &r) { return (r > eps) - (r < -eps); }
long long sgn(const long double &a, const long double &b) { return sgn(a - b); }
const long long MAX = (long long)2e5 + 5;
vector<string> split(const string &str, char sep) {
  vector<string> v;
  stringstream ss(str);
  string buffer;
  while (getline(ss, buffer, sep)) {
    v.push_back(buffer);
  }
  return v;
}
template <class InputIterator>
long long sum(InputIterator begin, InputIterator end) {
  return accumulate(begin, end, 0ll);
}
template <typename T>
T gcd(T a, T b) {
  T c;
  while (a != 0) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}
long long pow(long long a, long long b) {
  long long res = 1;
  for (long long i = 0; i < (long long)(b); ++i) res *= a;
  return res;
}
class Solver {
 public:
  long long H, W;
  long long N;
  vector<long long> A;
  bool ng(long long y, long long x) {
    return y < 0 || y >= H || x < 0 || x >= W;
  }
  long long ans() {
    vector<long long> B(N);
    B[0] = A[0];
    for (long long i = 0; i < (long long)(N - 1); ++i)
      B[i + 1] = B[i] + A[i + 1];
    long long cnt = 0;
    for (long long i = 0; i < (long long)(N); ++i) {
      long long cur = 0;
      for (long long j = (i); j < (long long)(N); ++j) {
        cur += A[j];
        if (cur == 0) cnt += 1;
      }
    }
    return cnt;
  }
  void solve() {
    cin >> N;
    A.resize(N);
    for (long long i = 0; i < (long long)(N); ++i) cin >> A[i];
    cout << ans() << endl;
  }
};
signed main() {
  srand(time(NULL));
  cout << fixed << setprecision(20);
  auto ptr = new Solver();
  ptr->solve();
  delete ptr;
  return 0;
}
