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