#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  int a[n + 100];
  for (long long int i = 0; i < ((long long int)(n)); i++) {
    cin >> a[i];
  }
  int tmp = 0;
  int sum[n + 100];
  sum[0] = 0;
  for (long long int i = 0; i < ((long long int)(n)); i++) {
    tmp = tmp + a[i];
    sum[i + 1] = tmp;
  }
  int cnt = 0, ln = 0;
  tmp = 0;
  for (long long int i = 0; i < ((long long int)(n)); i++) {
    ln = i + 1;
    for (long long int j = 0; j < ((long long int)(n - i)); j++) {
      tmp = sum[j + ln] - sum[j];
      if (tmp == 0) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}
