#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long sum = 0, a;
  vector<long long> s(n + 1);
  s[0] = sum;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    s[i] = (sum += a);
  }
  long long count = 0LL;
  for (int i = 0; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (0LL == s[j] - s[i]) {
        ++count;
      }
    }
  }
  cout << count << endl;
  return 0;
}
