#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll factorial(int i) {
  if (i == 0) return 1;
  return (factorial(i - 1)) * i;
}
int main() {
  int n;
  cin >> n;
  vector<int> rui(n + 1);
  rui[0] = 0;
  int count = 0;
  for (int i = 1; i <= (int)(n); i++) {
    int A;
    cin >> A;
    rui[i] += rui[i - 1] + A;
    if (rui[i] == 0) count++;
  }
  for (int i = 0; i < (int)(n + 1); i++) {
    for (int j = 1; j < i; j++)
      if (rui[i] - rui[j] == 0) count++;
  }
  cout << count << endl;
}
