#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int ans = 0;
  vector<int> A(N);
  vector<int> A_t(N + 1);
  for (int a = 0; a < N; a++) {
    cin >> A[a];
  }
  A_t[0] = 0;
  for (int b = 0; b < N + 1; b++) {
    A_t[b + 1] = A[b] + A_t[b];
  }
  for (int i = 0; i < N; i++) {
    for (int j = 1; j < N; j++) {
      if (A_t[i + j] - A_t[i] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
