#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long dp[n][n];
  long long ans = 0;
  for (int k = 0; k < n; k++) {
    long long t;
    cin >> t;
    if (k == 0) {
      dp[0][0] = t;
      continue;
    }
    for (int i = 0; i < k; i++) {
      dp[i][k] = dp[i][k - 1] + t;
      if (dp[i][k] == 0) ans++;
    }
    dp[k][k] = t;
    if (dp[k][k] == 0) ans++;
  }
  cout << ans << endl;
  return 0;
}
