#include <bits/stdc++.h>
using namespace std;
int N, A[200011], s = 0, a = 0;
int main() {
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> A[i];
  for (int c = 0; c < N; ++c) {
    s = 0;
    for (int i = c; i < N; ++i) {
      s += A[i];
      if (s == 0) ++a;
    }
  }
  cout << a << endl;
}
