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