unittest
{
	assert( [ "000" ].parse.expand.solve == 1 );
	assert( [ "10010010" ].parse.expand.solve == 3 );
	assert( [ "0" ].parse.expand.solve == 0 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front;
	return tuple( s );
}

auto solve( string s )
{
	auto wb = 0L;		// 白黒白黒…の順で並べるときの塗り替え要の枚数
	auto bw = 0L;		// 黒白黒白…の順で並べるときの塗り替え要の枚数
	foreach( i, c; s )
	{
		if( i % 2 == 0 )
		{
			if( c == '0' ) bw++;
			else           wb++;
		}
		else
		{
			if( c == '0' ) wb++;
			else           bw++;
		}
	}
	return min( wb, bw );
}
