import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Eric
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CColoringColorfully solver = new CColoringColorfully();
        solver.solve(1, in, out);
        out.close();
    }

    static class CColoringColorfully {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int nbChanges = solve1(s);
            out.println(nbChanges);
        }

        private int solve1(String s) {
            return Math.min(solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '0'),
                    solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '1'))
                    ;
        }

        private int solve1(String s, int pos, boolean endWith0) {
            if (pos == 0) {
                return s.charAt(0) == '0' == endWith0 ? 0 : 1;
            }

            int nbChanges1 = solve1(s, pos - 1, !endWith0);
            if ((s.charAt(pos) == '0') != endWith0)
                nbChanges1++;

            return nbChanges1;
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CColoringColorfully solver = new CColoringColorfully();
        solver.solve(1, in, out);
        out.close();
    }

    static class CColoringColorfully {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int nbChanges = solve1(s);
            out.println(nbChanges);
        }

        private int solve1(String s) {
            return Math.min(solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '0'),
                    solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '1'))
                    ;
        }

        private int solve1(String s, int pos, boolean endWith0) {
            if (pos == 0) {
                return s.charAt(0) == '0' == endWith0 ? 0 : 1;
            }

            int nbChanges1 = solve1(s, pos - 1, !endWith0);
            if ((s.charAt(pos) == '0') != endWith0)
                nbChanges1++;

            return nbChanges1;
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CColoringColorfully solver = new CColoringColorfully();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CColoringColorfully solver = new CColoringColorfully();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) CColoringColorfully solver = new CColoringColorfully(); solver new CColoringColorfully() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class CColoringColorfully {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int nbChanges = solve1(s);
            out.println(nbChanges);
        }

        private int solve1(String s) {
            return Math.min(solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '0'),
                    solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '1'))
                    ;
        }

        private int solve1(String s, int pos, boolean endWith0) {
            if (pos == 0) {
                return s.charAt(0) == '0' == endWith0 ? 0 : 1;
            }

            int nbChanges1 = solve1(s, pos - 1, !endWith0);
            if ((s.charAt(pos) == '0') != endWith0)
                nbChanges1++;

            return nbChanges1;
        }

    } CColoringColorfully public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int nbChanges = solve1(s);
            out.println(nbChanges);
        } solve {
            String s = in.next();
            int nbChanges = solve1(s);
            out.println(nbChanges);
        } String s = in.next(); s in.next() in.next in int nbChanges = solve1(s); nbChanges solve1(s) solve1 s out.println(nbChanges) out.println out nbChanges int testNumber testNumber Scanner in in PrintWriter out out private int solve1(String s) {
            return Math.min(solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '0'),
                    solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '1'))
                    ;
        } solve1 {
            return Math.min(solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '0'),
                    solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '1'))
                    ;
        } return Math.min(solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '0'),
                    solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '1'))
                    ; Math.min(solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '0'),
                    solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '1')) Math.min Math solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '0') solve1 s s.length() - 1 s.length() s.length s 1 s.charAt(s.length() - 1) == '0' s.charAt(s.length() - 1) s.charAt s s.length() - 1 s.length() s.length s 1 '0' solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '1') solve1 s s.length() - 1 s.length() s.length s 1 s.charAt(s.length() - 1) == '1' s.charAt(s.length() - 1) s.charAt s s.length() - 1 s.length() s.length s 1 '1' String s s private int solve1(String s, int pos, boolean endWith0) {
            if (pos == 0) {
                return s.charAt(0) == '0' == endWith0 ? 0 : 1;
            }

            int nbChanges1 = solve1(s, pos - 1, !endWith0);
            if ((s.charAt(pos) == '0') != endWith0)
                nbChanges1++;

            return nbChanges1;
        } solve1 {
            if (pos == 0) {
                return s.charAt(0) == '0' == endWith0 ? 0 : 1;
            }

            int nbChanges1 = solve1(s, pos - 1, !endWith0);
            if ((s.charAt(pos) == '0') != endWith0)
                nbChanges1++;

            return nbChanges1;
        } if (pos == 0) {
                return s.charAt(0) == '0' == endWith0 ? 0 : 1;
            } pos == 0 pos 0 {
                return s.charAt(0) == '0' == endWith0 ? 0 : 1;
            } return s.charAt(0) == '0' == endWith0 ? 0 : 1; s.charAt(0) == '0' == endWith0 ? 0 : 1 s.charAt(0) == '0' == endWith0 s.charAt(0) == '0' == endWith0 s.charAt(0) s.charAt s 0 '0' endWith0 0 1 int nbChanges1 = solve1(s, pos - 1, !endWith0); nbChanges1 solve1(s, pos - 1, !endWith0) solve1 s pos - 1 pos 1 !endWith0 endWith0 if ((s.charAt(pos) == '0') != endWith0)
                nbChanges1++; (s.charAt(pos) == '0') != endWith0 (s.charAt(pos) == '0') s.charAt(pos) s.charAt s pos '0' endWith0 nbChanges1++ nbChanges1 return nbChanges1; nbChanges1 String s s int pos pos boolean endWith0 endWith0 public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CColoringColorfully solver = new CColoringColorfully();
        solver.solve(1, in, out);
        out.close();
    }

    static class CColoringColorfully {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int nbChanges = solve1(s);
            out.println(nbChanges);
        }

        private int solve1(String s) {
            return Math.min(solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '0'),
                    solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '1'))
                    ;
        }

        private int solve1(String s, int pos, boolean endWith0) {
            if (pos == 0) {
                return s.charAt(0) == '0' == endWith0 ? 0 : 1;
            }

            int nbChanges1 = solve1(s, pos - 1, !endWith0);
            if ((s.charAt(pos) == '0') != endWith0)
                nbChanges1++;

            return nbChanges1;
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CColoringColorfully solver = new CColoringColorfully();
        solver.solve(1, in, out);
        out.close();
    }

    static class CColoringColorfully {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int nbChanges = solve1(s);
            out.println(nbChanges);
        }

        private int solve1(String s) {
            return Math.min(solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '0'),
                    solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '1'))
                    ;
        }

        private int solve1(String s, int pos, boolean endWith0) {
            if (pos == 0) {
                return s.charAt(0) == '0' == endWith0 ? 0 : 1;
            }

            int nbChanges1 = solve1(s, pos - 1, !endWith0);
            if ((s.charAt(pos) == '0') != endWith0)
                nbChanges1++;

            return nbChanges1;
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Eric
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CColoringColorfully solver = new CColoringColorfully();
        solver.solve(1, in, out);
        out.close();
    }

    static class CColoringColorfully {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int nbChanges = solve1(s);
            out.println(nbChanges);
        }

        private int solve1(String s) {
            return Math.min(solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '0'),
                    solve1(s, s.length() - 1, s.charAt(s.length() - 1) == '1'))
                    ;
        }

        private int solve1(String s, int pos, boolean endWith0) {
            if (pos == 0) {
                return s.charAt(0) == '0' == endWith0 ? 0 : 1;
            }

            int nbChanges1 = solve1(s, pos - 1, !endWith0);
            if ((s.charAt(pos) == '0') != endWith0)
                nbChanges1++;

            return nbChanges1;
        }

    }
}

