#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  long int a[N];
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    cin >> a[i];
  }
  int r = 0;
  for (int right = 0, right_len = (N); right < right_len; ++right) {
    for (int left = 0, left_len = (right); left < left_len; ++left) {
      long int temp = 0;
      for (int i = left; i < right + 1; i++) {
        temp += a[i];
      }
      if (temp == 0) {
        r++;
      }
    }
  }
  cout << r << "\n";
}
