#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a[200000];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  int b[200000];
  int num = 0;
  long long sum = 0;
  for (int i = 0; i < N; i++) {
    sum += a[i];
    b[i] = sum;
    if (sum == 0) num++;
  }
  for (int j = 0; j < N; j++) {
    for (int k = j + 1; k < N; k++) {
      if (b[k] - b[j] == 0) num++;
    }
  }
  cout << num << '\n';
  return 0;
}
