#include <bits/stdc++.h>
using namespace std;
using Int = long long;
Int INF = 1LL << 60;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  Int N;
  cin >> N;
  vector<Int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  vector<Int> s(N + 1);
  for (int i = 0; i < N; i++) {
    s[i + 1] = s[i] + a[i];
  }
  Int ans = 0;
  for (int i = 0; i <= N; i++) {
    for (int j = i + 1; j <= N; j++) {
      if (s[j] - s[i] == 0) ans++;
    }
  }
  cout << ans;
}
