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