#include <bits/stdc++.h>
using namespace std;
int ruisekiwa(int N, int M, vector<int> a) {
  vector<int> sum(a.size() + 1);
  int sum2 = 0;
  for (int i = 0; i < (int)(a.size()); i++) {
    sum2 += a.at(i);
    sum.at(i + 1) = sum2;
  }
  return sum.at(M) - sum.at(N);
}
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < (int)(N); i++) {
    cin >> a.at(i);
  }
  int count = 0;
  int x;
  for (int i = 0; i < (int)(N); i++) {
    x = i + 1;
    for (int j = 0; j < (int)(N - x + 1); j++) {
      if (ruisekiwa(j, j + x, a) == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
  return 0;
}
