#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int *arr = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int left, right, ans = 0;
  long long *sum = new long long[n + 1];
  sum[0] = 0;
  for (int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + arr[i - 1];
  }
  sort(sum, sum + n + 1);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n + 1; j++) {
      if (sum[i] == sum[j]) {
        ans++;
      } else
        break;
    }
  }
  cout << ans << endl;
  delete[] arr;
  delete[] sum;
  return 0;
}
