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

count_1 = 0
color_1 = -1

arr.each do |s_i|
	if color_1 < 0
		color_1 = s_i
		next
	end
	if color_1 == s_i
		count_1 += 1
		if s_i == 1
			color_1 = 0
		else
			color_1 = 1
		end
	else
		color_1 = s_i
	end
end

count_2 = 0
if arr[0] == 1
	color_2 = 0
else
	color_2 = 1
end
color_2 = arr[0]

arr.each do |s_i|
	if color_2 == s_i
		count_2 += 1
		if s_i == 1
			color_2 = 0
		else
			color_2 = 1
		end
	else
		color_2 = s_i
	end
end

puts count_1 < count_2 ? count_1 : count_2
