# frozen_string_literal: true

# Generated by AtcoderGreedy on 2018-04-28
# AGC023 A
# Your code here
$N = gets.chomp.to_i

$A = gets.chomp.split(' ').map(&:to_i)

count = 0
$N.times do |i|
  (i...$N).each do |j|
    total = $A[i..j].reduce(:+)
    count += 1 if total == 0
  end
end

puts count
