import java.io.*;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String S = br.readLine();
        String S_[] = new String[S.length()];
        for (int i=0;i<S.length();i++){
            S_[i] = String.valueOf(S.charAt(i));
        }
        String cmp = "1";
        int zero = 0;
        int one = 0;
        for (int i=0;i<S.length();i++){
            if (S_[i].equals(cmp)){
                zero++;
            } else {
                one++;
            }
            if (cmp.equals("1")){
                cmp = "0";
            } else {
                cmp = "1";
            }
        }
        System.out.println(Math.min(zero,one));
    }
} import java.io.*; io.* java class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String S = br.readLine();
        String S_[] = new String[S.length()];
        for (int i=0;i<S.length();i++){
            S_[i] = String.valueOf(S.charAt(i));
        }
        String cmp = "1";
        int zero = 0;
        int one = 0;
        for (int i=0;i<S.length();i++){
            if (S_[i].equals(cmp)){
                zero++;
            } else {
                one++;
            }
            if (cmp.equals("1")){
                cmp = "0";
            } else {
                cmp = "1";
            }
        }
        System.out.println(Math.min(zero,one));
    }
} Main public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String S = br.readLine();
        String S_[] = new String[S.length()];
        for (int i=0;i<S.length();i++){
            S_[i] = String.valueOf(S.charAt(i));
        }
        String cmp = "1";
        int zero = 0;
        int one = 0;
        for (int i=0;i<S.length();i++){
            if (S_[i].equals(cmp)){
                zero++;
            } else {
                one++;
            }
            if (cmp.equals("1")){
                cmp = "0";
            } else {
                cmp = "1";
            }
        }
        System.out.println(Math.min(zero,one));
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String S = br.readLine();
        String S_[] = new String[S.length()];
        for (int i=0;i<S.length();i++){
            S_[i] = String.valueOf(S.charAt(i));
        }
        String cmp = "1";
        int zero = 0;
        int one = 0;
        for (int i=0;i<S.length();i++){
            if (S_[i].equals(cmp)){
                zero++;
            } else {
                one++;
            }
            if (cmp.equals("1")){
                cmp = "0";
            } else {
                cmp = "1";
            }
        }
        System.out.println(Math.min(zero,one));
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String S = br.readLine(); S br.readLine() br.readLine br String S_[] = new String[S.length()]; S_ new String[S.length()] S.length() S.length S for (int i=0;i<S.length();i++){
            S_[i] = String.valueOf(S.charAt(i));
        } int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
            S_[i] = String.valueOf(S.charAt(i));
        } {
            S_[i] = String.valueOf(S.charAt(i));
        } S_[i] = String.valueOf(S.charAt(i)) S_[i] S_ i String.valueOf(S.charAt(i)) String.valueOf String S.charAt(i) S.charAt S i String cmp = "1"; cmp "1" int zero = 0; zero 0 int one = 0; one 0 for (int i=0;i<S.length();i++){
            if (S_[i].equals(cmp)){
                zero++;
            } else {
                one++;
            }
            if (cmp.equals("1")){
                cmp = "0";
            } else {
                cmp = "1";
            }
        } int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
            if (S_[i].equals(cmp)){
                zero++;
            } else {
                one++;
            }
            if (cmp.equals("1")){
                cmp = "0";
            } else {
                cmp = "1";
            }
        } {
            if (S_[i].equals(cmp)){
                zero++;
            } else {
                one++;
            }
            if (cmp.equals("1")){
                cmp = "0";
            } else {
                cmp = "1";
            }
        } if (S_[i].equals(cmp)){
                zero++;
            } else {
                one++;
            } S_[i].equals(cmp) S_[i].equals S_[i] S_ i cmp {
                zero++;
            } zero++ zero {
                one++;
            } one++ one if (cmp.equals("1")){
                cmp = "0";
            } else {
                cmp = "1";
            } cmp.equals("1") cmp.equals cmp "1" {
                cmp = "0";
            } cmp = "0" cmp "0" {
                cmp = "1";
            } cmp = "1" cmp "1" 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
import java.io.*;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String S = br.readLine();
        String S_[] = new String[S.length()];
        for (int i=0;i<S.length();i++){
            S_[i] = String.valueOf(S.charAt(i));
        }
        String cmp = "1";
        int zero = 0;
        int one = 0;
        for (int i=0;i<S.length();i++){
            if (S_[i].equals(cmp)){
                zero++;
            } else {
                one++;
            }
            if (cmp.equals("1")){
                cmp = "0";
            } else {
                cmp = "1";
            }
        }
        System.out.println(Math.min(zero,one));
    }
}