#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp;
int main() {
  long long n, x;
  mp[0] = 1;
  long long cnt = 0;
  long long sum = 0;
  scanf("%lld", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &x);
    sum += x;
    cnt += mp[sum];
    mp[sum]++;
  }
}
