#include <bits/stdc++.h>
using namespace std;
const static int MAX_N = 200000;
int N;
int A[MAX_N];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) scanf("%d", &A[i]);
  int cnt = 0;
  long long sum = 0;
  for (int i = 0; i < N; i++) {
    sum = 0;
    for (int j = i; j < N; j++) {
      sum += A[j];
      if (sum == 0) {
        cnt += 1;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
