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