#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (long long i = 0; i < (n); i++) {
    cin >> a[i];
  }
  int j = 0, ans = 0;
  for (long long i = 0; i < (n); i++) {
    long long sum = 0;
    for (long long j = i; j < (n); j++) {
      sum += a[j];
      if (sum == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
