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