#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int main() {
  int cont;
  int n;
  int num[maxn];
  int sum;
  while (scanf("%d", &n) != EOF) {
    cont = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &num[i]);
    }
    for (int i = 1; i <= n; i++) {
      sum = num[i];
      if (!sum) cont++;
      for (int j = i + 1; j <= n; j++) {
        sum += num[j];
        if (sum == 0) cont++;
      }
    }
    printf("%d\n", cont);
  }
  return 0;
}
