#include <bits/stdc++.h>
using namespace std;
int N;
vector<long long> A;
vector<vector<long long>> Hoge;
int res;
int main() {
  cin >> N;
  A = vector<long long>(N);
  Hoge = vector<vector<long long>>(N, vector<long long>(N));
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long sum = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      sum += A[j];
      if (sum == 0) {
        res++;
      }
    }
    sum = 0;
  }
  cout << res << endl;
  return 0;
}
