#include <bits/stdc++.h>
using namespace std;
string mojiretu[100020];
int mojiretu2[100020][26] = {0};
int mojiretu3[100020] = {0};
long int a[200010], b[200010];
int main() {
  int n;
  int ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  b[0] = 0;
  for (int i = 1; i < n + 1; i++) {
    b[i] = a[i - 1] + b[i - 1];
  }
  for (int i = n; i > 0; i--) {
    for (int j = 0; j < i; j++) {
      if (b[i] - b[j] == 0) {
        ans++;
      }
    }
  }
  cout << ans;
}
