#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  int count = 0;
  for (int i = 0; i < N; i++) {
    long long total = 0;
    for (int j = i; j < N; j++) {
      total += a[j];
      if (total == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
  return 0;
}
