import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    // 10:33-
    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            String s = sc.next();
            int[][] dp = new int[2][s.length()];
            char c = s.charAt(0);
            dp[0][0] = (c == '1' ? 1 : 0);
            dp[1][0] = (c == '0' ? 1 : 0);

            for (int i = 1; i < s.length(); i++) {
                char x = s.charAt(i);
                dp[0][i] = (x == '1' ? 1 : 0) + dp[1][i - 1];
                dp[1][i] = (x == '0' ? 1 : 0) + dp[0][i - 1];
            }

            out.println(Math.min(dp[0][s.length() - 1], dp[1][s.length() - 1]));
        }
    }
} import java.io.BufferedInputStream; BufferedInputStream java.io import java.io.BufferedOutputStream; BufferedOutputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {

    // 10:33-
    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            String s = sc.next();
            int[][] dp = new int[2][s.length()];
            char c = s.charAt(0);
            dp[0][0] = (c == '1' ? 1 : 0);
            dp[1][0] = (c == '0' ? 1 : 0);

            for (int i = 1; i < s.length(); i++) {
                char x = s.charAt(i);
                dp[0][i] = (x == '1' ? 1 : 0) + dp[1][i - 1];
                dp[1][i] = (x == '0' ? 1 : 0) + dp[0][i - 1];
            }

            out.println(Math.min(dp[0][s.length() - 1], dp[1][s.length() - 1]));
        }
    }
} Main // 10:33-
    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            String s = sc.next();
            int[][] dp = new int[2][s.length()];
            char c = s.charAt(0);
            dp[0][0] = (c == '1' ? 1 : 0);
            dp[1][0] = (c == '0' ? 1 : 0);

            for (int i = 1; i < s.length(); i++) {
                char x = s.charAt(i);
                dp[0][i] = (x == '1' ? 1 : 0) + dp[1][i - 1];
                dp[1][i] = (x == '0' ? 1 : 0) + dp[0][i - 1];
            }

            out.println(Math.min(dp[0][s.length() - 1], dp[1][s.length() - 1]));
        }
    } main {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            String s = sc.next();
            int[][] dp = new int[2][s.length()];
            char c = s.charAt(0);
            dp[0][0] = (c == '1' ? 1 : 0);
            dp[1][0] = (c == '0' ? 1 : 0);

            for (int i = 1; i < s.length(); i++) {
                char x = s.charAt(i);
                dp[0][i] = (x == '1' ? 1 : 0) + dp[1][i - 1];
                dp[1][i] = (x == '0' ? 1 : 0) + dp[0][i - 1];
            }

            out.println(Math.min(dp[0][s.length() - 1], dp[1][s.length() - 1]));
        }
    } try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            String s = sc.next();
            int[][] dp = new int[2][s.length()];
            char c = s.charAt(0);
            dp[0][0] = (c == '1' ? 1 : 0);
            dp[1][0] = (c == '0' ? 1 : 0);

            for (int i = 1; i < s.length(); i++) {
                char x = s.charAt(i);
                dp[0][i] = (x == '1' ? 1 : 0) + dp[1][i - 1];
                dp[1][i] = (x == '0' ? 1 : 0) + dp[0][i - 1];
            }

            out.println(Math.min(dp[0][s.length() - 1], dp[1][s.length() - 1]));
        } {

            Scanner sc = new Scanner(in);

            String s = sc.next();
            int[][] dp = new int[2][s.length()];
            char c = s.charAt(0);
            dp[0][0] = (c == '1' ? 1 : 0);
            dp[1][0] = (c == '0' ? 1 : 0);

            for (int i = 1; i < s.length(); i++) {
                char x = s.charAt(i);
                dp[0][i] = (x == '1' ? 1 : 0) + dp[1][i - 1];
                dp[1][i] = (x == '0' ? 1 : 0) + dp[0][i - 1];
            }

            out.println(Math.min(dp[0][s.length() - 1], dp[1][s.length() - 1]));
        } BufferedInputStream in = new BufferedInputStream(System.in) BufferedInputStream in = new BufferedInputStream(System.in) new BufferedInputStream(System.in) PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)) PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)) new PrintWriter(new BufferedOutputStream(System.out)) Scanner sc = new Scanner(in); sc new Scanner(in) String s = sc.next(); s sc.next() sc.next sc int[][] dp = new int[2][s.length()]; dp new int[2][s.length()] 2 s.length() s.length s char c = s.charAt(0); c s.charAt(0) s.charAt s 0 dp[0][0] = (c == '1' ? 1 : 0) dp[0][0] dp[0] dp 0 0 (c == '1' ? 1 : 0) c == '1' c '1' 1 0 dp[1][0] = (c == '0' ? 1 : 0) dp[1][0] dp[1] dp 1 0 (c == '0' ? 1 : 0) c == '0' c '0' 1 0 for (int i = 1; i < s.length(); i++) {
                char x = s.charAt(i);
                dp[0][i] = (x == '1' ? 1 : 0) + dp[1][i - 1];
                dp[1][i] = (x == '0' ? 1 : 0) + dp[0][i - 1];
            } int i = 1; int i = 1; i 1 i < s.length() i s.length() s.length s i++ i++ i {
                char x = s.charAt(i);
                dp[0][i] = (x == '1' ? 1 : 0) + dp[1][i - 1];
                dp[1][i] = (x == '0' ? 1 : 0) + dp[0][i - 1];
            } {
                char x = s.charAt(i);
                dp[0][i] = (x == '1' ? 1 : 0) + dp[1][i - 1];
                dp[1][i] = (x == '0' ? 1 : 0) + dp[0][i - 1];
            } char x = s.charAt(i); x s.charAt(i) s.charAt s i dp[0][i] = (x == '1' ? 1 : 0) + dp[1][i - 1] dp[0][i] dp[0] dp 0 i (x == '1' ? 1 : 0) + dp[1][i - 1] (x == '1' ? 1 : 0) x == '1' x '1' 1 0 dp[1][i - 1] dp[1] dp 1 i - 1 i 1 dp[1][i] = (x == '0' ? 1 : 0) + dp[0][i - 1] dp[1][i] dp[1] dp 1 i (x == '0' ? 1 : 0) + dp[0][i - 1] (x == '0' ? 1 : 0) x == '0' x '0' 1 0 dp[0][i - 1] dp[0] dp 0 i - 1 i 1 out.println(Math.min(dp[0][s.length() - 1], dp[1][s.length() - 1])) out.println out Math.min(dp[0][s.length() - 1], dp[1][s.length() - 1]) Math.min Math dp[0][s.length() - 1] dp[0] dp 0 s.length() - 1 s.length() s.length s 1 dp[1][s.length() - 1] dp[1] dp 1 s.length() - 1 s.length() s.length s 1 String[] args args public class Main {

    // 10:33-
    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            String s = sc.next();
            int[][] dp = new int[2][s.length()];
            char c = s.charAt(0);
            dp[0][0] = (c == '1' ? 1 : 0);
            dp[1][0] = (c == '0' ? 1 : 0);

            for (int i = 1; i < s.length(); i++) {
                char x = s.charAt(i);
                dp[0][i] = (x == '1' ? 1 : 0) + dp[1][i - 1];
                dp[1][i] = (x == '0' ? 1 : 0) + dp[0][i - 1];
            }

            out.println(Math.min(dp[0][s.length() - 1], dp[1][s.length() - 1]));
        }
    }
} public class Main {

    // 10:33-
    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            String s = sc.next();
            int[][] dp = new int[2][s.length()];
            char c = s.charAt(0);
            dp[0][0] = (c == '1' ? 1 : 0);
            dp[1][0] = (c == '0' ? 1 : 0);

            for (int i = 1; i < s.length(); i++) {
                char x = s.charAt(i);
                dp[0][i] = (x == '1' ? 1 : 0) + dp[1][i - 1];
                dp[1][i] = (x == '0' ? 1 : 0) + dp[0][i - 1];
            }

            out.println(Math.min(dp[0][s.length() - 1], dp[1][s.length() - 1]));
        }
    }
} Main
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    // 10:33-
    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            String s = sc.next();
            int[][] dp = new int[2][s.length()];
            char c = s.charAt(0);
            dp[0][0] = (c == '1' ? 1 : 0);
            dp[1][0] = (c == '0' ? 1 : 0);

            for (int i = 1; i < s.length(); i++) {
                char x = s.charAt(i);
                dp[0][i] = (x == '1' ? 1 : 0) + dp[1][i - 1];
                dp[1][i] = (x == '0' ? 1 : 0) + dp[0][i - 1];
            }

            out.println(Math.min(dp[0][s.length() - 1], dp[1][s.length() - 1]));
        }
    }
}
