#include <bits/stdc++.h>
using namespace std;
int main() {
  int N = 0, count = 0;
  cin >> N;
  int* A = new int[N];
  int* S = new int[N];
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++)
    for (int j = 0; j < i + 1; j++) S[i] += A[j];
  for (int i = 0; i < N; i++) {
    if (S[i] == 0) count++;
    for (int j = i + 1; j < N; j++)
      if (S[i] == S[j]) count++;
  }
  cout << count << endl;
  return 0;
}
