import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    // input
    static String s;

    /**
     * input
     */
    static void input(){
        Scanner sc = new Scanner(System.in);
        s = sc.next();
        sc.close();
    }
 
    /**
     * solver
     */
    static void solve(){
        int ans = 0;

        int n = s.length();

        // minimum cost to convert substring s(0:i) -> ...0101
        int[] a = new int[n];

        // minimum cost to convert substring s(0:i) -> ...1010
        int[] b = new int[n];

        // init
        if (s.charAt(0) == '0'){
            a[0] = 1;
            b[0] = 0;
        } else {
            a[0] = 0;
            b[0] = 1;
        }

        // recursion
        for(int i=1;i<n;i++){
            if (s.charAt(i) == '0') {
                a[i] = 1 + b[i-1];
                b[i] = a[i-1];
            } else {
                a[i] = b[i-1];
                b[i] = 1 + a[i-1];
            }
        }

        ans = Math.min(a[n-1], b[n-1]);

        System.out.println(ans);
    }

    public static void main(String args[]) {

        input();

        solve();
    }
} import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util import java.util.stream.Collectors; Collectors java.util.stream public class Main {

    // input
    static String s;

    /**
     * input
     */
    static void input(){
        Scanner sc = new Scanner(System.in);
        s = sc.next();
        sc.close();
    }
 
    /**
     * solver
     */
    static void solve(){
        int ans = 0;

        int n = s.length();

        // minimum cost to convert substring s(0:i) -> ...0101
        int[] a = new int[n];

        // minimum cost to convert substring s(0:i) -> ...1010
        int[] b = new int[n];

        // init
        if (s.charAt(0) == '0'){
            a[0] = 1;
            b[0] = 0;
        } else {
            a[0] = 0;
            b[0] = 1;
        }

        // recursion
        for(int i=1;i<n;i++){
            if (s.charAt(i) == '0') {
                a[i] = 1 + b[i-1];
                b[i] = a[i-1];
            } else {
                a[i] = b[i-1];
                b[i] = 1 + a[i-1];
            }
        }

        ans = Math.min(a[n-1], b[n-1]);

        System.out.println(ans);
    }

    public static void main(String args[]) {

        input();

        solve();
    }
} Main // input
    static String s; s /**
     * input
     */
    static void input(){
        Scanner sc = new Scanner(System.in);
        s = sc.next();
        sc.close();
    } input {
        Scanner sc = new Scanner(System.in);
        s = sc.next();
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) s = sc.next() s sc.next() sc.next sc sc.close() sc.close sc /**
     * solver
     */
    static void solve(){
        int ans = 0;

        int n = s.length();

        // minimum cost to convert substring s(0:i) -> ...0101
        int[] a = new int[n];

        // minimum cost to convert substring s(0:i) -> ...1010
        int[] b = new int[n];

        // init
        if (s.charAt(0) == '0'){
            a[0] = 1;
            b[0] = 0;
        } else {
            a[0] = 0;
            b[0] = 1;
        }

        // recursion
        for(int i=1;i<n;i++){
            if (s.charAt(i) == '0') {
                a[i] = 1 + b[i-1];
                b[i] = a[i-1];
            } else {
                a[i] = b[i-1];
                b[i] = 1 + a[i-1];
            }
        }

        ans = Math.min(a[n-1], b[n-1]);

        System.out.println(ans);
    } solve {
        int ans = 0;

        int n = s.length();

        // minimum cost to convert substring s(0:i) -> ...0101
        int[] a = new int[n];

        // minimum cost to convert substring s(0:i) -> ...1010
        int[] b = new int[n];

        // init
        if (s.charAt(0) == '0'){
            a[0] = 1;
            b[0] = 0;
        } else {
            a[0] = 0;
            b[0] = 1;
        }

        // recursion
        for(int i=1;i<n;i++){
            if (s.charAt(i) == '0') {
                a[i] = 1 + b[i-1];
                b[i] = a[i-1];
            } else {
                a[i] = b[i-1];
                b[i] = 1 + a[i-1];
            }
        }

        ans = Math.min(a[n-1], b[n-1]);

        System.out.println(ans);
    } int ans = 0; ans 0 int n = s.length(); n s.length() s.length s int[] a = new int[n]; a new int[n] n int[] b = new int[n]; b new int[n] n if (s.charAt(0) == '0'){
            a[0] = 1;
            b[0] = 0;
        } else {
            a[0] = 0;
            b[0] = 1;
        } s.charAt(0) == '0' s.charAt(0) s.charAt s 0 '0' {
            a[0] = 1;
            b[0] = 0;
        } a[0] = 1 a[0] a 0 1 b[0] = 0 b[0] b 0 0 {
            a[0] = 0;
            b[0] = 1;
        } a[0] = 0 a[0] a 0 0 b[0] = 1 b[0] b 0 1 for(int i=1;i<n;i++){
            if (s.charAt(i) == '0') {
                a[i] = 1 + b[i-1];
                b[i] = a[i-1];
            } else {
                a[i] = b[i-1];
                b[i] = 1 + a[i-1];
            }
        } int i=1; int i=1; i 1 i<n i n i++ i++ i {
            if (s.charAt(i) == '0') {
                a[i] = 1 + b[i-1];
                b[i] = a[i-1];
            } else {
                a[i] = b[i-1];
                b[i] = 1 + a[i-1];
            }
        } {
            if (s.charAt(i) == '0') {
                a[i] = 1 + b[i-1];
                b[i] = a[i-1];
            } else {
                a[i] = b[i-1];
                b[i] = 1 + a[i-1];
            }
        } if (s.charAt(i) == '0') {
                a[i] = 1 + b[i-1];
                b[i] = a[i-1];
            } else {
                a[i] = b[i-1];
                b[i] = 1 + a[i-1];
            } s.charAt(i) == '0' s.charAt(i) s.charAt s i '0' {
                a[i] = 1 + b[i-1];
                b[i] = a[i-1];
            } a[i] = 1 + b[i-1] a[i] a i 1 + b[i-1] 1 b[i-1] b i-1 i 1 b[i] = a[i-1] b[i] b i a[i-1] a i-1 i 1 {
                a[i] = b[i-1];
                b[i] = 1 + a[i-1];
            } a[i] = b[i-1] a[i] a i b[i-1] b i-1 i 1 b[i] = 1 + a[i-1] b[i] b i 1 + a[i-1] 1 a[i-1] a i-1 i 1 ans = Math.min(a[n-1], b[n-1]) ans Math.min(a[n-1], b[n-1]) Math.min Math a[n-1] a n-1 n 1 b[n-1] b n-1 n 1 System.out.println(ans) System.out.println System.out System System.out ans public static void main(String args[]) {

        input();

        solve();
    } main {

        input();

        solve();
    } input() input solve() solve String args[] args public class Main {

    // input
    static String s;

    /**
     * input
     */
    static void input(){
        Scanner sc = new Scanner(System.in);
        s = sc.next();
        sc.close();
    }
 
    /**
     * solver
     */
    static void solve(){
        int ans = 0;

        int n = s.length();

        // minimum cost to convert substring s(0:i) -> ...0101
        int[] a = new int[n];

        // minimum cost to convert substring s(0:i) -> ...1010
        int[] b = new int[n];

        // init
        if (s.charAt(0) == '0'){
            a[0] = 1;
            b[0] = 0;
        } else {
            a[0] = 0;
            b[0] = 1;
        }

        // recursion
        for(int i=1;i<n;i++){
            if (s.charAt(i) == '0') {
                a[i] = 1 + b[i-1];
                b[i] = a[i-1];
            } else {
                a[i] = b[i-1];
                b[i] = 1 + a[i-1];
            }
        }

        ans = Math.min(a[n-1], b[n-1]);

        System.out.println(ans);
    }

    public static void main(String args[]) {

        input();

        solve();
    }
} public class Main {

    // input
    static String s;

    /**
     * input
     */
    static void input(){
        Scanner sc = new Scanner(System.in);
        s = sc.next();
        sc.close();
    }
 
    /**
     * solver
     */
    static void solve(){
        int ans = 0;

        int n = s.length();

        // minimum cost to convert substring s(0:i) -> ...0101
        int[] a = new int[n];

        // minimum cost to convert substring s(0:i) -> ...1010
        int[] b = new int[n];

        // init
        if (s.charAt(0) == '0'){
            a[0] = 1;
            b[0] = 0;
        } else {
            a[0] = 0;
            b[0] = 1;
        }

        // recursion
        for(int i=1;i<n;i++){
            if (s.charAt(i) == '0') {
                a[i] = 1 + b[i-1];
                b[i] = a[i-1];
            } else {
                a[i] = b[i-1];
                b[i] = 1 + a[i-1];
            }
        }

        ans = Math.min(a[n-1], b[n-1]);

        System.out.println(ans);
    }

    public static void main(String args[]) {

        input();

        solve();
    }
} Main
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    // input
    static String s;

    /**
     * input
     */
    static void input(){
        Scanner sc = new Scanner(System.in);
        s = sc.next();
        sc.close();
    }
 
    /**
     * solver
     */
    static void solve(){
        int ans = 0;

        int n = s.length();

        // minimum cost to convert substring s(0:i) -> ...0101
        int[] a = new int[n];

        // minimum cost to convert substring s(0:i) -> ...1010
        int[] b = new int[n];

        // init
        if (s.charAt(0) == '0'){
            a[0] = 1;
            b[0] = 0;
        } else {
            a[0] = 0;
            b[0] = 1;
        }

        // recursion
        for(int i=1;i<n;i++){
            if (s.charAt(i) == '0') {
                a[i] = 1 + b[i-1];
                b[i] = a[i-1];
            } else {
                a[i] = b[i-1];
                b[i] = 1 + a[i-1];
            }
        }

        ans = Math.min(a[n-1], b[n-1]);

        System.out.println(ans);
    }

    public static void main(String args[]) {

        input();

        solve();
    }
}
