n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
dp = [0]
n.times do |i|
    dp << a[i] + dp[i]
end
rod_length = dp[-1]
mid = dp.bsearch{|x| x >= rod_length/2}
ans = 0

is_increment = rod_length - mid > mid

until rod_length - mid == mid do
    if is_increment then
        mid += 1
        rod_length += 1
    else
        mid -= 1
        rod_length -= 1
    end
    ans += 1
end

puts ans