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