#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int count = 0;
  cin >> n;
  vector<int> a(n);
  vector<int> second(n + 1);
  int ans = INT_MIN;
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
    second[i + 1] = second[i];
    second[i + 1] += a[i];
  }
  for (int i = 0; i < (int)(n); i++)
    for (int j = i + 1; j <= n; j++) {
      if (second[j] == second[i]) {
        count++;
      }
    }
  cout << count << endl;
  return 0;
}
