#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n), b(n + 1);
  for (auto&& i : a) {
    cin >> i;
  }
  int ans = 0;
  partial_sum(begin(a), end(a), begin(b) + 1);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (b[j] - b[i]) continue;
      ans++;
    }
  }
  cout << ans << "\n";
}
