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