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