#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 1;
long long qzh[maxn];
int A[maxn];
int N, M, q1, q2;
int main() {
  scanf("%d", &N);
  int ans = 0;
  qzh[0] = 0;
  for (int i = 1; i <= N; i++) {
    scanf("%d", &A[i]);
    qzh[i] = qzh[i - 1] + A[i];
  }
  for (int i = 1; i <= N; i++) {
    for (int j = i; j <= N; j++) {
      if (qzh[j] - qzh[i - 1] == 0) ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
