#include <bits/stdc++.h>
using namespace std;
int asc(const void *a, const void *b) { return *(int *)a - *(int *)b; }
int desc(const void *a, const void *b) { return *(int *)b - *(int *)a; }
int main() {
  long long n, ans = 0;
  cin >> n;
  int a, s[n + 1];
  s[0] = 0;
  for (int(i) = (1); (i) < (n + 1); ++(i)) {
    cin >> a;
    s[i] = s[i - 1] + a;
  }
  for (int(i) = 0; (i) < (n); ++(i)) {
    for (int(j) = (i + 1); (j) < (n + 1); ++(j)) {
      if (s[j] - s[i] == 0) {
        ++ans;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
