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