import java.util.Scanner;

public class Main {

		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			
			String color = sc.next();
			int N =color.length();
			
			int odd_0 = 0;
			int even_0 = 0;
			int odd_1 = 0;
			int even_1 = 0;
			
			
			for (int i=0;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					odd_0+=1;
				else 
					odd_1=odd_1-1;
			}	
			
			for (int i=1;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					even_0+=1;
				else 
					even_1=even_1-1;
			}
			
			
			int ans = Math.max(odd_0-even_1, even_0-odd_1);
			System.out.println(N-ans);
			
		}

	} import java.util.Scanner; Scanner java.util public class Main {

		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			
			String color = sc.next();
			int N =color.length();
			
			int odd_0 = 0;
			int even_0 = 0;
			int odd_1 = 0;
			int even_1 = 0;
			
			
			for (int i=0;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					odd_0+=1;
				else 
					odd_1=odd_1-1;
			}	
			
			for (int i=1;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					even_0+=1;
				else 
					even_1=even_1-1;
			}
			
			
			int ans = Math.max(odd_0-even_1, even_0-odd_1);
			System.out.println(N-ans);
			
		}

	} Main public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			
			String color = sc.next();
			int N =color.length();
			
			int odd_0 = 0;
			int even_0 = 0;
			int odd_1 = 0;
			int even_1 = 0;
			
			
			for (int i=0;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					odd_0+=1;
				else 
					odd_1=odd_1-1;
			}	
			
			for (int i=1;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					even_0+=1;
				else 
					even_1=even_1-1;
			}
			
			
			int ans = Math.max(odd_0-even_1, even_0-odd_1);
			System.out.println(N-ans);
			
		} main {
			Scanner sc = new Scanner(System.in);
			
			String color = sc.next();
			int N =color.length();
			
			int odd_0 = 0;
			int even_0 = 0;
			int odd_1 = 0;
			int even_1 = 0;
			
			
			for (int i=0;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					odd_0+=1;
				else 
					odd_1=odd_1-1;
			}	
			
			for (int i=1;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					even_0+=1;
				else 
					even_1=even_1-1;
			}
			
			
			int ans = Math.max(odd_0-even_1, even_0-odd_1);
			System.out.println(N-ans);
			
		} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String color = sc.next(); color sc.next() sc.next sc int N =color.length(); N color.length() color.length color int odd_0 = 0; odd_0 0 int even_0 = 0; even_0 0 int odd_1 = 0; odd_1 0 int even_1 = 0; even_1 0 for (int i=0;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					odd_0+=1;
				else 
					odd_1=odd_1-1;
			} int i=0; int i=0; i 0 i<N i N i=i+2 i=i+2 i i+2 i 2 {
				if (color.charAt(i) == '0')
					odd_0+=1;
				else 
					odd_1=odd_1-1;
			} {
				if (color.charAt(i) == '0')
					odd_0+=1;
				else 
					odd_1=odd_1-1;
			} if (color.charAt(i) == '0')
					odd_0+=1;
				else 
					odd_1=odd_1-1; color.charAt(i) == '0' color.charAt(i) color.charAt color i '0' odd_0+=1 odd_0 1 odd_1=odd_1-1 odd_1 odd_1-1 odd_1 1 for (int i=1;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					even_0+=1;
				else 
					even_1=even_1-1;
			} int i=1; int i=1; i 1 i<N i N i=i+2 i=i+2 i i+2 i 2 {
				if (color.charAt(i) == '0')
					even_0+=1;
				else 
					even_1=even_1-1;
			} {
				if (color.charAt(i) == '0')
					even_0+=1;
				else 
					even_1=even_1-1;
			} if (color.charAt(i) == '0')
					even_0+=1;
				else 
					even_1=even_1-1; color.charAt(i) == '0' color.charAt(i) color.charAt color i '0' even_0+=1 even_0 1 even_1=even_1-1 even_1 even_1-1 even_1 1 int ans = Math.max(odd_0-even_1, even_0-odd_1); ans Math.max(odd_0-even_1, even_0-odd_1) Math.max Math odd_0-even_1 odd_0 even_1 even_0-odd_1 even_0 odd_1 System.out.println(N-ans) System.out.println System.out System System.out N-ans N ans String[] args args public class Main {

		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			
			String color = sc.next();
			int N =color.length();
			
			int odd_0 = 0;
			int even_0 = 0;
			int odd_1 = 0;
			int even_1 = 0;
			
			
			for (int i=0;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					odd_0+=1;
				else 
					odd_1=odd_1-1;
			}	
			
			for (int i=1;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					even_0+=1;
				else 
					even_1=even_1-1;
			}
			
			
			int ans = Math.max(odd_0-even_1, even_0-odd_1);
			System.out.println(N-ans);
			
		}

	} public class Main {

		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			
			String color = sc.next();
			int N =color.length();
			
			int odd_0 = 0;
			int even_0 = 0;
			int odd_1 = 0;
			int even_1 = 0;
			
			
			for (int i=0;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					odd_0+=1;
				else 
					odd_1=odd_1-1;
			}	
			
			for (int i=1;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					even_0+=1;
				else 
					even_1=even_1-1;
			}
			
			
			int ans = Math.max(odd_0-even_1, even_0-odd_1);
			System.out.println(N-ans);
			
		}

	} Main
import java.util.Scanner;

public class Main {

		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			
			String color = sc.next();
			int N =color.length();
			
			int odd_0 = 0;
			int even_0 = 0;
			int odd_1 = 0;
			int even_1 = 0;
			
			
			for (int i=0;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					odd_0+=1;
				else 
					odd_1=odd_1-1;
			}	
			
			for (int i=1;i<N;i=i+2) {
				if (color.charAt(i) == '0')
					even_0+=1;
				else 
					even_1=even_1-1;
			}
			
			
			int ans = Math.max(odd_0-even_1, even_0-odd_1);
			System.out.println(N-ans);
			
		}

	}
