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