#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, input, sum = 0, count = 0;
  vector<int> A, s;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> input;
    A.push_back(input);
  }
  s.push_back(0);
  for (int i = 0; i < N; i++) {
    sum += A[i];
    s.push_back(sum);
  }
  for (int i = 0; i < N + 1; i++) {
    for (int j = i + 1; j < N + 1; j++) {
      if (s[j] == s[i]) count++;
    }
  }
  cout << count;
  char qq;
  cin >> qq;
  return 0;
}
