line = gets.split('').map(&:to_i)
t = 0
k = line.size - 1

#puts line[4]
k.times do |i|
  if line[i] == 1
    t += 1
  end
#  puts "#{i},#{t}"
end

t_counter = k-t
if t > t_counter then
  u = t - t_counter
else
  u = t_counter - t
end

puts k-u
