#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0;
  int t;
  vector<int> a;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    a.push_back(t);
  }
  int sum = 0;
  int count = 0;
  for (int i = 0; i < n; i++) {
    sum = 0;
    for (int j = i; j < n; j++) {
      sum += a[j];
      if (sum == 0) {
        count++;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}
