#include <bits/stdc++.h>
using namespace std;
long long num[100000];
long long a[100000];
long long a_sum[100000];
int main() {
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> a[i];
  a[0] = 0;
  long long sum = 0;
  for (int i = 0; i <= N; i++) {
    sum += a[i];
    a_sum[i] = sum;
  }
  long long res = 0;
  for (int i = 0; i <= N; i++)
    for (int j = i + 1; j <= N; j++) {
      if (a_sum[j] - a_sum[i] == 0) res++;
    }
  cout << res << endl;
}
