#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")

#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007;

int main(){
  int n; cin >> n;
  int a[n];
  rep(i,n) cin >> a[i];
  int sum_a[n] = {a[0]};
  for(int i = 1; i < n; i++){
    sum_a[i] = sum_a[i-1] + a[i];
  }
  int ans = 0;
  rep(i,n){
    for(int j = i+1; j<n; j++){
      if(sum_a[j]-sum_a[i] == 0) ans++;
    }
  }
  cout << ans << "\n";
}