#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const* argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N + 1);
  A[0] = 0;
  int sum = 0;
  for (int i = 1; i <= N; ++i) {
    cin >> A[i];
    sum += A[i];
    A[i] = sum;
  }
  int count = 0;
  for (int i = 0; i <= N; ++i) {
    for (int j = i + 1; j <= N; ++j) {
      if (A[i] == A[j]) {
        ++count;
      }
    }
  }
  cout << count << '\n';
  return 0;
}
