import java.io.*;
import java.util.*;
import static java.lang.System.in;

public class Main {
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args){
        char[] s = sc.next().toCharArray();
        int n = s.length;
        int[] black = new int[n], white = new int[n]; // black[i]: paint the i-th to be black
        // The i-th tile from the left is painted black if the i-th character of S
        // is 0, and painted white if that character is 1.
        black[0] = s[0]=='1'?1:0; white[0] = s[0]=='0'?1:0;
        for(int i=1;i<n;i++){
            if(s[i]=='0'){
                black[i] = white[i-1];
                white[i] = black[i-1]+1;
            } else{
                white[i] = black[i-1];
                black[i] = white[i-1]+1;
            }
        }
        System.out.println(Math.min(white[n-1],black[n-1]));
    }
} import java.io.*; io.* java import java.util.*; util.* java import static java.lang.System.in; import static java.lang.System.in; import static java.lang.System.in; public class Main {
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args){
        char[] s = sc.next().toCharArray();
        int n = s.length;
        int[] black = new int[n], white = new int[n]; // black[i]: paint the i-th to be black
        // The i-th tile from the left is painted black if the i-th character of S
        // is 0, and painted white if that character is 1.
        black[0] = s[0]=='1'?1:0; white[0] = s[0]=='0'?1:0;
        for(int i=1;i<n;i++){
            if(s[i]=='0'){
                black[i] = white[i-1];
                white[i] = black[i-1]+1;
            } else{
                white[i] = black[i-1];
                black[i] = white[i-1]+1;
            }
        }
        System.out.println(Math.min(white[n-1],black[n-1]));
    }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) public static void main(String[] args){
        char[] s = sc.next().toCharArray();
        int n = s.length;
        int[] black = new int[n], white = new int[n]; // black[i]: paint the i-th to be black
        // The i-th tile from the left is painted black if the i-th character of S
        // is 0, and painted white if that character is 1.
        black[0] = s[0]=='1'?1:0; white[0] = s[0]=='0'?1:0;
        for(int i=1;i<n;i++){
            if(s[i]=='0'){
                black[i] = white[i-1];
                white[i] = black[i-1]+1;
            } else{
                white[i] = black[i-1];
                black[i] = white[i-1]+1;
            }
        }
        System.out.println(Math.min(white[n-1],black[n-1]));
    } main {
        char[] s = sc.next().toCharArray();
        int n = s.length;
        int[] black = new int[n], white = new int[n]; // black[i]: paint the i-th to be black
        // The i-th tile from the left is painted black if the i-th character of S
        // is 0, and painted white if that character is 1.
        black[0] = s[0]=='1'?1:0; white[0] = s[0]=='0'?1:0;
        for(int i=1;i<n;i++){
            if(s[i]=='0'){
                black[i] = white[i-1];
                white[i] = black[i-1]+1;
            } else{
                white[i] = black[i-1];
                black[i] = white[i-1]+1;
            }
        }
        System.out.println(Math.min(white[n-1],black[n-1]));
    } char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int n = s.length; n s.length s s.length int[] black = new int[n] black new int[n] n white = new int[n]; white new int[n] n black[0] = s[0]=='1'?1:0 black[0] black 0 s[0]=='1'?1:0 s[0]=='1' s[0] s 0 '1' 1 0 white[0] = s[0]=='0'?1:0 white[0] white 0 s[0]=='0'?1:0 s[0]=='0' s[0] s 0 '0' 1 0 for(int i=1;i<n;i++){
            if(s[i]=='0'){
                black[i] = white[i-1];
                white[i] = black[i-1]+1;
            } else{
                white[i] = black[i-1];
                black[i] = white[i-1]+1;
            }
        } int i=1; int i=1; i 1 i<n i n i++ i++ i {
            if(s[i]=='0'){
                black[i] = white[i-1];
                white[i] = black[i-1]+1;
            } else{
                white[i] = black[i-1];
                black[i] = white[i-1]+1;
            }
        } {
            if(s[i]=='0'){
                black[i] = white[i-1];
                white[i] = black[i-1]+1;
            } else{
                white[i] = black[i-1];
                black[i] = white[i-1]+1;
            }
        } if(s[i]=='0'){
                black[i] = white[i-1];
                white[i] = black[i-1]+1;
            } else{
                white[i] = black[i-1];
                black[i] = white[i-1]+1;
            } s[i]=='0' s[i] s i '0' {
                black[i] = white[i-1];
                white[i] = black[i-1]+1;
            } black[i] = white[i-1] black[i] black i white[i-1] white i-1 i 1 white[i] = black[i-1]+1 white[i] white i black[i-1]+1 black[i-1] black i-1 i 1 1 {
                white[i] = black[i-1];
                black[i] = white[i-1]+1;
            } white[i] = black[i-1] white[i] white i black[i-1] black i-1 i 1 black[i] = white[i-1]+1 black[i] black i white[i-1]+1 white[i-1] white i-1 i 1 1 System.out.println(Math.min(white[n-1],black[n-1])) System.out.println System.out System System.out Math.min(white[n-1],black[n-1]) Math.min Math white[n-1] white n-1 n 1 black[n-1] black n-1 n 1 String[] args args public class Main {
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args){
        char[] s = sc.next().toCharArray();
        int n = s.length;
        int[] black = new int[n], white = new int[n]; // black[i]: paint the i-th to be black
        // The i-th tile from the left is painted black if the i-th character of S
        // is 0, and painted white if that character is 1.
        black[0] = s[0]=='1'?1:0; white[0] = s[0]=='0'?1:0;
        for(int i=1;i<n;i++){
            if(s[i]=='0'){
                black[i] = white[i-1];
                white[i] = black[i-1]+1;
            } else{
                white[i] = black[i-1];
                black[i] = white[i-1]+1;
            }
        }
        System.out.println(Math.min(white[n-1],black[n-1]));
    }
} public class Main {
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args){
        char[] s = sc.next().toCharArray();
        int n = s.length;
        int[] black = new int[n], white = new int[n]; // black[i]: paint the i-th to be black
        // The i-th tile from the left is painted black if the i-th character of S
        // is 0, and painted white if that character is 1.
        black[0] = s[0]=='1'?1:0; white[0] = s[0]=='0'?1:0;
        for(int i=1;i<n;i++){
            if(s[i]=='0'){
                black[i] = white[i-1];
                white[i] = black[i-1]+1;
            } else{
                white[i] = black[i-1];
                black[i] = white[i-1]+1;
            }
        }
        System.out.println(Math.min(white[n-1],black[n-1]));
    }
} Main
import java.io.*;
import java.util.*;
import static java.lang.System.in;

public class Main {
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args){
        char[] s = sc.next().toCharArray();
        int n = s.length;
        int[] black = new int[n], white = new int[n]; // black[i]: paint the i-th to be black
        // The i-th tile from the left is painted black if the i-th character of S
        // is 0, and painted white if that character is 1.
        black[0] = s[0]=='1'?1:0; white[0] = s[0]=='0'?1:0;
        for(int i=1;i<n;i++){
            if(s[i]=='0'){
                black[i] = white[i-1];
                white[i] = black[i-1]+1;
            } else{
                white[i] = black[i-1];
                black[i] = white[i-1]+1;
            }
        }
        System.out.println(Math.min(white[n-1],black[n-1]));
    }
}