#include <bits/stdc++.h>
using namespace std;
long long sum[200005];
int countPairs(long long arr[], int n) {
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (sum[i] == sum[j]) cnt++;
    }
    if (sum[i] == 0) cnt++;
  }
  return cnt;
}
int main() {
  int n = 0;
  memset(sum, 0, sizeof(sum));
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long num = 0;
    cin >> num;
    sum[i] = sum[i - 1] + num;
  }
  cout << countPairs(sum, n);
  return 0;
}
