#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int count = 0;
  cin >> N;
  int A[220000];
  int cum[220000] = {0};
  for (int i = 1; i <= (int)(N); i++) {
    int a;
    cin >> a;
    A[i] = a;
    cum[i] = cum[i - 1] + A[i];
  }
  for (int i = 0; i < (int)(N); i++) {
    for (int j = i + 1; j <= N; j++) {
      if (cum[i] == cum[j]) {
        count++;
      }
    }
  }
  cout << count << endl;
}
