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