use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

chomp (my $n = <STDIN>);
chomp (my @a = split / /, <STDIN>);
my (@e, @f);
$f[0] = 0;
$e[$n] = 0;
for my $i (1..$n-1) {
  $f[$i] = $a[$i-1] + $f[$i-1];
  $e[$n-$i] = $a[$n-$i] + $e[$n-$i+1];
}
my $sum;
$sum += $_ for @a; 
my $ans = 0;
for my $i (0..$n-1) {
  for my $j ($i+1..$n) {
    $ans++ if 0 == $sum - $f[$i] - $e[$j];
  }
}
say $ans;