import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Tiles t = new Tiles(sc.nextLine());
		System.out.println(t.check101());
	}

}
class Tiles{
	char[] chars;
	Tiles(String s){
		chars = s.toCharArray();
//		System.out.println(chars.length);

	}
	int check101(){
		char c = '1';
		int count =0;
//		System.out.println(chars.length);
		for(int i = 0; i < chars.length; i++) {
			if(chars[i] == c) {
				count++;
//				System.out.println(count);
			}
			if(c == '1') {
				c = '0';
			}else {
				c = '1';
			}
//			System.out.println(c);
		}
		if(count <= chars.length / 2) {
			return count;
		}else {
			return chars.length -count;
		}
	}
} import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Tiles t = new Tiles(sc.nextLine());
		System.out.println(t.check101());
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Tiles t = new Tiles(sc.nextLine());
		System.out.println(t.check101());
	} main {
		Scanner sc = new Scanner(System.in);
		Tiles t = new Tiles(sc.nextLine());
		System.out.println(t.check101());
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Tiles t = new Tiles(sc.nextLine()); t new Tiles(sc.nextLine()) System.out.println(t.check101()) System.out.println System.out System System.out t.check101() t.check101 t String[] args args class Tiles{
	char[] chars;
	Tiles(String s){
		chars = s.toCharArray();
//		System.out.println(chars.length);

	}
	int check101(){
		char c = '1';
		int count =0;
//		System.out.println(chars.length);
		for(int i = 0; i < chars.length; i++) {
			if(chars[i] == c) {
				count++;
//				System.out.println(count);
			}
			if(c == '1') {
				c = '0';
			}else {
				c = '1';
			}
//			System.out.println(c);
		}
		if(count <= chars.length / 2) {
			return count;
		}else {
			return chars.length -count;
		}
	}
} Tiles char[] chars; chars Tiles(String s){
		chars = s.toCharArray();
//		System.out.println(chars.length);

	} Tiles {
		chars = s.toCharArray();
//		System.out.println(chars.length);

	} chars = s.toCharArray() chars s.toCharArray() s.toCharArray s String s s int check101(){
		char c = '1';
		int count =0;
//		System.out.println(chars.length);
		for(int i = 0; i < chars.length; i++) {
			if(chars[i] == c) {
				count++;
//				System.out.println(count);
			}
			if(c == '1') {
				c = '0';
			}else {
				c = '1';
			}
//			System.out.println(c);
		}
		if(count <= chars.length / 2) {
			return count;
		}else {
			return chars.length -count;
		}
	} check101 {
		char c = '1';
		int count =0;
//		System.out.println(chars.length);
		for(int i = 0; i < chars.length; i++) {
			if(chars[i] == c) {
				count++;
//				System.out.println(count);
			}
			if(c == '1') {
				c = '0';
			}else {
				c = '1';
			}
//			System.out.println(c);
		}
		if(count <= chars.length / 2) {
			return count;
		}else {
			return chars.length -count;
		}
	} char c = '1'; c '1' int count =0; count 0 for(int i = 0; i < chars.length; i++) {
			if(chars[i] == c) {
				count++;
//				System.out.println(count);
			}
			if(c == '1') {
				c = '0';
			}else {
				c = '1';
			}
//			System.out.println(c);
		} int i = 0; int i = 0; i 0 i < chars.length i chars.length chars chars.length i++ i++ i {
			if(chars[i] == c) {
				count++;
//				System.out.println(count);
			}
			if(c == '1') {
				c = '0';
			}else {
				c = '1';
			}
//			System.out.println(c);
		} {
			if(chars[i] == c) {
				count++;
//				System.out.println(count);
			}
			if(c == '1') {
				c = '0';
			}else {
				c = '1';
			}
//			System.out.println(c);
		} if(chars[i] == c) {
				count++;
//				System.out.println(count);
			} chars[i] == c chars[i] chars i c {
				count++;
//				System.out.println(count);
			} count++ count if(c == '1') {
				c = '0';
			}else {
				c = '1';
			} c == '1' c '1' {
				c = '0';
			} c = '0' c '0' {
				c = '1';
			} c = '1' c '1' if(count <= chars.length / 2) {
			return count;
		}else {
			return chars.length -count;
		} count <= chars.length / 2 count chars.length / 2 chars.length chars chars.length 2 {
			return count;
		} return count; count {
			return chars.length -count;
		} return chars.length -count; chars.length -count chars.length chars chars.length count public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Tiles t = new Tiles(sc.nextLine());
		System.out.println(t.check101());
	}

} public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Tiles t = new Tiles(sc.nextLine());
		System.out.println(t.check101());
	}

} Main
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Tiles t = new Tiles(sc.nextLine());
		System.out.println(t.check101());
	}

}
class Tiles{
	char[] chars;
	Tiles(String s){
		chars = s.toCharArray();
//		System.out.println(chars.length);

	}
	int check101(){
		char c = '1';
		int count =0;
//		System.out.println(chars.length);
		for(int i = 0; i < chars.length; i++) {
			if(chars[i] == c) {
				count++;
//				System.out.println(count);
			}
			if(c == '1') {
				c = '0';
			}else {
				c = '1';
			}
//			System.out.println(c);
		}
		if(count <= chars.length / 2) {
			return count;
		}else {
			return chars.length -count;
		}
	}
}
