#include <bits/stdc++.h>
const int MOD = 1000000009;
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int a[200005];
  int sum[200005] = {};
  int cnt = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum[i] = sum[i - 1] + a[i];
  }
  sort(sum, sum + n + 1);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (sum[i] == sum[j]) cnt++;
    }
  }
  cout << cnt << '\n';
  return 0;
}
