#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;
  vector<long> clist;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    for (int j = 0; j < clist.size(); j++) {
      clist[j] += a[i];
      if (clist[j] == 0) count++;
    }
    if (a[i] == 0) count++;
    clist.push_back(a[i]);
  }
  cout << count << endl;
  return 0;
}
