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