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