#include <bits/stdc++.h>
using namespace std;
int main() {
  long int N;
  cin >> N;
  long int a[10000000], b[1000000], c[10000000];
  int count = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    c[i] = a[i];
  }
  for (int i = 1; i < N; i++) {
    for (int j = 0; j < i; j++) {
      c[j] += a[i];
      if (c[j] == 0) count++;
    }
  }
  if (c[0] == 0) count--;
  cout << count << endl;
  return 0;
}
