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