#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  string in;
  cin >> n;
  vector<int> A(n);
  for (int i = 0; i < n; ++i) {
    cin >> in;
    A[i] = stoi(in);
  }
  int buf, count;
  for (int i = 0; i < n; ++i) {
    buf = 0;
    for (int j = i; j < n; ++j) {
      buf += A[j];
      if (buf == 0) {
        ++count;
      }
    }
  }
  cout << count;
  return 0;
}
