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