#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  int N;
  cin >> N;
  int A[N + 1];
  A[0] = 0;
  int sum = 0;
  for (int i = 0; i < (int)(N); i++) {
    int a;
    cin >> a;
    sum += a;
    A[i + 1] = sum;
  }
  int count = 0;
  for (int i = 0; i <= N; i++) {
    for (int j = i + 1; j <= N; j++) {
      if (A[j] - A[i] == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
  return 0;
}
