#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int *arr = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int left, right, ans = 0;
  long long sum = 0;
  for (left = 0; left < n; left++) {
    sum = 0;
    for (right = left; right < n; right++) {
      sum += arr[right];
      if (sum == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  delete[] arr;
  return 0;
}
