import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        if(s.length == 1) {
            System.out.println(0);
            return;
        }
        int zero = 0;
        int one = 0;
        for (int i = 0; i < s.length; i++) {
            if(s[i] == '0' && i % 2 == 0) {
                zero++;
            } else if(s[i] == '1' && i % 2 == 0) {
                one++;
            } else if(s[i] == '0' && i % 2 == 1) {
                one++;
            } else if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            }
        }
        zero = s.length - zero;
        one = s.length - one;
        System.out.println(Math.min(zero, one));

    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        if(s.length == 1) {
            System.out.println(0);
            return;
        }
        int zero = 0;
        int one = 0;
        for (int i = 0; i < s.length; i++) {
            if(s[i] == '0' && i % 2 == 0) {
                zero++;
            } else if(s[i] == '1' && i % 2 == 0) {
                one++;
            } else if(s[i] == '0' && i % 2 == 1) {
                one++;
            } else if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            }
        }
        zero = s.length - zero;
        one = s.length - one;
        System.out.println(Math.min(zero, one));

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        if(s.length == 1) {
            System.out.println(0);
            return;
        }
        int zero = 0;
        int one = 0;
        for (int i = 0; i < s.length; i++) {
            if(s[i] == '0' && i % 2 == 0) {
                zero++;
            } else if(s[i] == '1' && i % 2 == 0) {
                one++;
            } else if(s[i] == '0' && i % 2 == 1) {
                one++;
            } else if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            }
        }
        zero = s.length - zero;
        one = s.length - one;
        System.out.println(Math.min(zero, one));

    } main {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        if(s.length == 1) {
            System.out.println(0);
            return;
        }
        int zero = 0;
        int one = 0;
        for (int i = 0; i < s.length; i++) {
            if(s[i] == '0' && i % 2 == 0) {
                zero++;
            } else if(s[i] == '1' && i % 2 == 0) {
                one++;
            } else if(s[i] == '0' && i % 2 == 1) {
                one++;
            } else if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            }
        }
        zero = s.length - zero;
        one = s.length - one;
        System.out.println(Math.min(zero, one));

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc if(s.length == 1) {
            System.out.println(0);
            return;
        } s.length == 1 s.length s s.length 1 {
            System.out.println(0);
            return;
        } System.out.println(0) System.out.println System.out System System.out 0 return; int zero = 0; zero 0 int one = 0; one 0 for (int i = 0; i < s.length; i++) {
            if(s[i] == '0' && i % 2 == 0) {
                zero++;
            } else if(s[i] == '1' && i % 2 == 0) {
                one++;
            } else if(s[i] == '0' && i % 2 == 1) {
                one++;
            } else if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            }
        } int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
            if(s[i] == '0' && i % 2 == 0) {
                zero++;
            } else if(s[i] == '1' && i % 2 == 0) {
                one++;
            } else if(s[i] == '0' && i % 2 == 1) {
                one++;
            } else if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            }
        } {
            if(s[i] == '0' && i % 2 == 0) {
                zero++;
            } else if(s[i] == '1' && i % 2 == 0) {
                one++;
            } else if(s[i] == '0' && i % 2 == 1) {
                one++;
            } else if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            }
        } if(s[i] == '0' && i % 2 == 0) {
                zero++;
            } else if(s[i] == '1' && i % 2 == 0) {
                one++;
            } else if(s[i] == '0' && i % 2 == 1) {
                one++;
            } else if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            } s[i] == '0' && i % 2 == 0 s[i] == '0' s[i] s i '0' i % 2 == 0 i % 2 i 2 0 {
                zero++;
            } zero++ zero if(s[i] == '1' && i % 2 == 0) {
                one++;
            } else if(s[i] == '0' && i % 2 == 1) {
                one++;
            } else if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            } s[i] == '1' && i % 2 == 0 s[i] == '1' s[i] s i '1' i % 2 == 0 i % 2 i 2 0 {
                one++;
            } one++ one if(s[i] == '0' && i % 2 == 1) {
                one++;
            } else if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            } s[i] == '0' && i % 2 == 1 s[i] == '0' s[i] s i '0' i % 2 == 1 i % 2 i 2 1 {
                one++;
            } one++ one if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            } s[i] == '1' && i % 2 == 1 s[i] == '1' s[i] s i '1' i % 2 == 1 i % 2 i 2 1 {
                zero++;
            } zero++ zero {
                System.out.println(0);
                return;
            } System.out.println(0) System.out.println System.out System System.out 0 return; zero = s.length - zero zero s.length - zero s.length s s.length zero one = s.length - one one s.length - one s.length s s.length one System.out.println(Math.min(zero, one)) System.out.println System.out System System.out Math.min(zero, one) Math.min Math zero one String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        if(s.length == 1) {
            System.out.println(0);
            return;
        }
        int zero = 0;
        int one = 0;
        for (int i = 0; i < s.length; i++) {
            if(s[i] == '0' && i % 2 == 0) {
                zero++;
            } else if(s[i] == '1' && i % 2 == 0) {
                one++;
            } else if(s[i] == '0' && i % 2 == 1) {
                one++;
            } else if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            }
        }
        zero = s.length - zero;
        one = s.length - one;
        System.out.println(Math.min(zero, one));

    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        if(s.length == 1) {
            System.out.println(0);
            return;
        }
        int zero = 0;
        int one = 0;
        for (int i = 0; i < s.length; i++) {
            if(s[i] == '0' && i % 2 == 0) {
                zero++;
            } else if(s[i] == '1' && i % 2 == 0) {
                one++;
            } else if(s[i] == '0' && i % 2 == 1) {
                one++;
            } else if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            }
        }
        zero = s.length - zero;
        one = s.length - one;
        System.out.println(Math.min(zero, one));

    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        if(s.length == 1) {
            System.out.println(0);
            return;
        }
        int zero = 0;
        int one = 0;
        for (int i = 0; i < s.length; i++) {
            if(s[i] == '0' && i % 2 == 0) {
                zero++;
            } else if(s[i] == '1' && i % 2 == 0) {
                one++;
            } else if(s[i] == '0' && i % 2 == 1) {
                one++;
            } else if(s[i] == '1' && i % 2 == 1) {
                zero++;
            } else {
                System.out.println(0);
                return;
            }
        }
        zero = s.length - zero;
        one = s.length - one;
        System.out.println(Math.min(zero, one));

    }
}