#include <bits/stdc++.h>
using namespace std;
long long a[200002], dp[200002];
int main(void) {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", a + i);
    dp[i] += dp[i - 1] + a[i];
  }
  long long ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = 1; j + i <= n; j++) {
      if (dp[j + i] - dp[j - 1] == 0) ans++;
    }
  return !printf("%lld\n", ans);
}
