#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 2e5 + 10;
int N;
int A[N_MAX];
int main() {
  cin >> N;
  for (int(i) = (0); (i) < (N); ++(i)) cin >> A[i];
  int cnt = 0;
  for (int(i) = (0); (i) < (N); ++(i)) {
    int s = 0;
    for (int(j) = (i); (j) < (N); ++(j)) {
      s += A[j];
      if (s == 0) ++cnt;
    }
  }
  cout << cnt << endl;
  return 0;
}
