#include <bits/stdc++.h>
using namespace std;
int A[200001];
int main() {
  int N;
  scanf("%d", &N);
  int ans = 0;
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    if (A[i] == 0) ans++;
  }
  long long cur, prev;
  for (int i = 0; i < N - 1; i++) {
    prev = A[i];
    for (int j = i + 1; j < N; j++) {
      cur = prev + A[j];
      if (cur == 0) ans++;
      prev = cur;
    }
  }
  printf("%d\n", ans);
}
