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