#include <bits/stdc++.h>
using namespace std;
const long long int MAX_N = 200000;
int main(int argc, char const *argv[]) {
  int N;
  cin >> N;
  int A[MAX_N];
  for (long long int i = 0; i < N; i++) cin >> A[i];
  long long int ans = 0;
  for (long long int i = 0; i < N; i++) {
    long long int temp = 0;
    for (size_t j = i; j < N; j++) {
      temp += A[j];
      if (temp == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
