#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long int> A(N);
  vector<long long int> sum(N), prev(N);
  long long int cnt = 0, val = 0, ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    sum[i] = 0;
    prev[i] = 0;
  }
  for (int i = 0; i < N; i++) {
    val = 0;
    int cnt = 0;
    for (int j = i; j < N; j++) {
      val += A[j];
      if (val == 0) cnt++;
    }
    ans += cnt;
  }
  cout << "ans: " << ans << endl;
  return 0;
}
