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