#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<vector<int> > b(n, vector<int>(n));
  for (int k = 0; k < n; ++k) {
    cin >> a.at(k);
  }
  int group = 0;
  int i = 0;
  int j = 0;
  while (i < n - 1) {
    j = i + 1;
    while (j < n) {
      if (i == 0 && j == 1) {
        b[i][j] = a[i] + a[j];
      } else if (i != 0 && j == i + 1) {
        b[i][j] = b[i - 1][j] - a[i - 1];
      } else {
        b[i][j] = b[i][j - 1] + a[j];
      }
      if (b[i][j] == 0) {
        group += 1;
      }
      ++j;
    }
    ++i;
  }
  cout << group << endl;
  return 0;
}
