#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
  int n, ans = 0;
  cin >> n;
  vector<long long> a(n), s(n + 1, 0);
  for (int i = 0; i < (n); i++) cin >> a[i], s[i + 1] = a[i] + s[i];
  for (int i = 0; i < n + 1; ++i) {
    for (int j = i + 1; j < n + 1; ++j) {
      if (s[j] - s[i] == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
