#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n), b(n + 1);
  for (auto& i : a) cin >> i;
  for (int j = 0; j < n; j++) {
    b[j + 1] = b[j] + a[j];
  }
  long long g = 0;
  for (int j = 1; j < n + 1; j++) {
    for (int i = 0; i < j; i++) {
      if (b[j] == b[i]) g += 1;
    }
  }
  cout << g << endl;
  return 0;
}
