#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i = 0; i < N; ++i) {
    cin >> v[i];
  }
  vector<int> s(N + 1), r(N + 1);
  s[0] = 0;
  for (int i = 0; i < N; ++i) {
    s[i + 1] = s[i] + v[i];
  }
  int c = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N + 1; ++j) {
      if (s[j] - s[i] == 0) c++;
    }
  }
  cout << c;
  return 0;
}
