#include <bits/stdc++.h>
int main(void) {
  int n;
  std::cin >> n;
  long long pref[n + 1];
  memset(pref, 0, sizeof(pref));
  for (int i = 1; i <= n; i++) {
    long long z;
    std::cin >> z;
    pref[i] = pref[i - 1] + z;
  }
  long long ctr = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (!(pref[j] - pref[i])) ctr++;
    }
  }
  std::cout << ctr << "\n";
  return 0;
}
