#include <bits/stdc++.h>
using namespace std;
int N;
int A[200005];
int prefixsum[200005];
int ans = 0;
int sum(int left, int right) { return prefixsum[right] - prefixsum[left - 1]; }
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  for (int i = 1; i <= N; i++) {
    prefixsum[i] = prefixsum[i - 1] + A[i];
  }
  for (int i = 1; i <= N; i++) {
    for (int j = i; j <= N; j++) {
      if (sum(i, j) == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
