import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        System.out.println(Math.min(count(s,'1'),count(s,'0')));
        sc.close();
    }
    static int count(String s,char c){
        char pre = c;
        int cnt = 0;
        if(pre != s.charAt(0)) ++cnt;
        for(int i = 1; i<s.length(); i++){
            //System.out.println(pre);
            if(s.charAt(i) == pre) cnt++;
            if(pre == '1') pre = '0';
            else pre = '1';
        }
        return cnt;
    }
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        System.out.println(Math.min(count(s,'1'),count(s,'0')));
        sc.close();
    }
    static int count(String s,char c){
        char pre = c;
        int cnt = 0;
        if(pre != s.charAt(0)) ++cnt;
        for(int i = 1; i<s.length(); i++){
            //System.out.println(pre);
            if(s.charAt(i) == pre) cnt++;
            if(pre == '1') pre = '0';
            else pre = '1';
        }
        return cnt;
    }
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        System.out.println(Math.min(count(s,'1'),count(s,'0')));
        sc.close();
    } main {
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        System.out.println(Math.min(count(s,'1'),count(s,'0')));
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc System.out.println(Math.min(count(s,'1'),count(s,'0'))) System.out.println System.out System System.out Math.min(count(s,'1'),count(s,'0')) Math.min Math count(s,'1') count s '1' count(s,'0') count s '0' sc.close() sc.close sc String[] args args static int count(String s,char c){
        char pre = c;
        int cnt = 0;
        if(pre != s.charAt(0)) ++cnt;
        for(int i = 1; i<s.length(); i++){
            //System.out.println(pre);
            if(s.charAt(i) == pre) cnt++;
            if(pre == '1') pre = '0';
            else pre = '1';
        }
        return cnt;
    } count {
        char pre = c;
        int cnt = 0;
        if(pre != s.charAt(0)) ++cnt;
        for(int i = 1; i<s.length(); i++){
            //System.out.println(pre);
            if(s.charAt(i) == pre) cnt++;
            if(pre == '1') pre = '0';
            else pre = '1';
        }
        return cnt;
    } char pre = c; pre c int cnt = 0; cnt 0 if(pre != s.charAt(0)) ++cnt; pre != s.charAt(0) pre s.charAt(0) s.charAt s 0 ++cnt cnt for(int i = 1; i<s.length(); i++){
            //System.out.println(pre);
            if(s.charAt(i) == pre) cnt++;
            if(pre == '1') pre = '0';
            else pre = '1';
        } int i = 1; int i = 1; i 1 i<s.length() i s.length() s.length s i++ i++ i {
            //System.out.println(pre);
            if(s.charAt(i) == pre) cnt++;
            if(pre == '1') pre = '0';
            else pre = '1';
        } {
            //System.out.println(pre);
            if(s.charAt(i) == pre) cnt++;
            if(pre == '1') pre = '0';
            else pre = '1';
        } if(s.charAt(i) == pre) cnt++; s.charAt(i) == pre s.charAt(i) s.charAt s i pre cnt++ cnt if(pre == '1') pre = '0';
            else pre = '1'; pre == '1' pre '1' pre = '0' pre '0' pre = '1' pre '1' return cnt; cnt String s s char c c public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        System.out.println(Math.min(count(s,'1'),count(s,'0')));
        sc.close();
    }
    static int count(String s,char c){
        char pre = c;
        int cnt = 0;
        if(pre != s.charAt(0)) ++cnt;
        for(int i = 1; i<s.length(); i++){
            //System.out.println(pre);
            if(s.charAt(i) == pre) cnt++;
            if(pre == '1') pre = '0';
            else pre = '1';
        }
        return cnt;
    }
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        System.out.println(Math.min(count(s,'1'),count(s,'0')));
        sc.close();
    }
    static int count(String s,char c){
        char pre = c;
        int cnt = 0;
        if(pre != s.charAt(0)) ++cnt;
        for(int i = 1; i<s.length(); i++){
            //System.out.println(pre);
            if(s.charAt(i) == pre) cnt++;
            if(pre == '1') pre = '0';
            else pre = '1';
        }
        return cnt;
    }
} Main
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s = sc.next();
        System.out.println(Math.min(count(s,'1'),count(s,'0')));
        sc.close();
    }
    static int count(String s,char c){
        char pre = c;
        int cnt = 0;
        if(pre != s.charAt(0)) ++cnt;
        for(int i = 1; i<s.length(); i++){
            //System.out.println(pre);
            if(s.charAt(i) == pre) cnt++;
            if(pre == '1') pre = '0';
            else pre = '1';
        }
        return cnt;
    }
}