#include <bits/stdc++.h>
using namespace std;
int N = 0;
int A[200020] = {0};
void input() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
}
int solve() {
  int ans = 0;
  for (int i = 0; i < N - 1; i++) {
    int temp = 0;
    temp = A[i];
    for (int j = i + 1; j < N; j++) {
      temp += A[j];
      if (!temp) ans++;
    }
  }
  return ans;
}
int main() {
  input();
  printf("%d\n", solve());
  return 0;
}
