import java.util.*;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int count = 0;
        int t[] = new int[s.length()];
        int t2[] = new int[s.length()];

		for (int i = 0; i < s.length(); i++) {
            t[i] = Integer.parseInt(s.substring(i, i+1));
            t2[i] = t[i];
		}

		for (int i = 1; i < s.length(); i++) {
			if (t[i] == t[i-1]) {
				if (t[i] == 0) {
					t[i] = 1;
				} else {
					t[i] = 0;
				}
				count++;
			}
        }
        
        int count2 = 0;
        if (s.length() >= 2 && t2[0] == t2[1]) {
            count2++;
            if (t2[0] == 0) {
                t2[0] = 1;
            } else {
                t2[0] = 0;
            }

            for (int i = 2; i < s.length(); i++) {
                if (t2[i] == t2[i-1]) {
                    if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    }

                count2++;
                }
            }
        }

        if (count2 > 0) {
            if (count < count2) {
                System.out.println(count);
            } else {
                System.out.println(count2);
            }
        } else {
            System.out.println(count);
        }
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int count = 0;
        int t[] = new int[s.length()];
        int t2[] = new int[s.length()];

		for (int i = 0; i < s.length(); i++) {
            t[i] = Integer.parseInt(s.substring(i, i+1));
            t2[i] = t[i];
		}

		for (int i = 1; i < s.length(); i++) {
			if (t[i] == t[i-1]) {
				if (t[i] == 0) {
					t[i] = 1;
				} else {
					t[i] = 0;
				}
				count++;
			}
        }
        
        int count2 = 0;
        if (s.length() >= 2 && t2[0] == t2[1]) {
            count2++;
            if (t2[0] == 0) {
                t2[0] = 1;
            } else {
                t2[0] = 0;
            }

            for (int i = 2; i < s.length(); i++) {
                if (t2[i] == t2[i-1]) {
                    if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    }

                count2++;
                }
            }
        }

        if (count2 > 0) {
            if (count < count2) {
                System.out.println(count);
            } else {
                System.out.println(count2);
            }
        } else {
            System.out.println(count);
        }
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int count = 0;
        int t[] = new int[s.length()];
        int t2[] = new int[s.length()];

		for (int i = 0; i < s.length(); i++) {
            t[i] = Integer.parseInt(s.substring(i, i+1));
            t2[i] = t[i];
		}

		for (int i = 1; i < s.length(); i++) {
			if (t[i] == t[i-1]) {
				if (t[i] == 0) {
					t[i] = 1;
				} else {
					t[i] = 0;
				}
				count++;
			}
        }
        
        int count2 = 0;
        if (s.length() >= 2 && t2[0] == t2[1]) {
            count2++;
            if (t2[0] == 0) {
                t2[0] = 1;
            } else {
                t2[0] = 0;
            }

            for (int i = 2; i < s.length(); i++) {
                if (t2[i] == t2[i-1]) {
                    if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    }

                count2++;
                }
            }
        }

        if (count2 > 0) {
            if (count < count2) {
                System.out.println(count);
            } else {
                System.out.println(count2);
            }
        } else {
            System.out.println(count);
        }
	} main {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int count = 0;
        int t[] = new int[s.length()];
        int t2[] = new int[s.length()];

		for (int i = 0; i < s.length(); i++) {
            t[i] = Integer.parseInt(s.substring(i, i+1));
            t2[i] = t[i];
		}

		for (int i = 1; i < s.length(); i++) {
			if (t[i] == t[i-1]) {
				if (t[i] == 0) {
					t[i] = 1;
				} else {
					t[i] = 0;
				}
				count++;
			}
        }
        
        int count2 = 0;
        if (s.length() >= 2 && t2[0] == t2[1]) {
            count2++;
            if (t2[0] == 0) {
                t2[0] = 1;
            } else {
                t2[0] = 0;
            }

            for (int i = 2; i < s.length(); i++) {
                if (t2[i] == t2[i-1]) {
                    if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    }

                count2++;
                }
            }
        }

        if (count2 > 0) {
            if (count < count2) {
                System.out.println(count);
            } else {
                System.out.println(count2);
            }
        } else {
            System.out.println(count);
        }
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int count = 0; count 0 int t[] = new int[s.length()]; t new int[s.length()] s.length() s.length s int t2[] = new int[s.length()]; t2 new int[s.length()] s.length() s.length s for (int i = 0; i < s.length(); i++) {
            t[i] = Integer.parseInt(s.substring(i, i+1));
            t2[i] = t[i];
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            t[i] = Integer.parseInt(s.substring(i, i+1));
            t2[i] = t[i];
		} {
            t[i] = Integer.parseInt(s.substring(i, i+1));
            t2[i] = t[i];
		} t[i] = Integer.parseInt(s.substring(i, i+1)) t[i] t i Integer.parseInt(s.substring(i, i+1)) Integer.parseInt Integer s.substring(i, i+1) s.substring s i i+1 i 1 t2[i] = t[i] t2[i] t2 i t[i] t i for (int i = 1; i < s.length(); i++) {
			if (t[i] == t[i-1]) {
				if (t[i] == 0) {
					t[i] = 1;
				} else {
					t[i] = 0;
				}
				count++;
			}
        } int i = 1; int i = 1; i 1 i < s.length() i s.length() s.length s i++ i++ i {
			if (t[i] == t[i-1]) {
				if (t[i] == 0) {
					t[i] = 1;
				} else {
					t[i] = 0;
				}
				count++;
			}
        } {
			if (t[i] == t[i-1]) {
				if (t[i] == 0) {
					t[i] = 1;
				} else {
					t[i] = 0;
				}
				count++;
			}
        } if (t[i] == t[i-1]) {
				if (t[i] == 0) {
					t[i] = 1;
				} else {
					t[i] = 0;
				}
				count++;
			} t[i] == t[i-1] t[i] t i t[i-1] t i-1 i 1 {
				if (t[i] == 0) {
					t[i] = 1;
				} else {
					t[i] = 0;
				}
				count++;
			} if (t[i] == 0) {
					t[i] = 1;
				} else {
					t[i] = 0;
				} t[i] == 0 t[i] t i 0 {
					t[i] = 1;
				} t[i] = 1 t[i] t i 1 {
					t[i] = 0;
				} t[i] = 0 t[i] t i 0 count++ count int count2 = 0; count2 0 if (s.length() >= 2 && t2[0] == t2[1]) {
            count2++;
            if (t2[0] == 0) {
                t2[0] = 1;
            } else {
                t2[0] = 0;
            }

            for (int i = 2; i < s.length(); i++) {
                if (t2[i] == t2[i-1]) {
                    if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    }

                count2++;
                }
            }
        } s.length() >= 2 && t2[0] == t2[1] s.length() >= 2 s.length() s.length s 2 t2[0] == t2[1] t2[0] t2 0 t2[1] t2 1 {
            count2++;
            if (t2[0] == 0) {
                t2[0] = 1;
            } else {
                t2[0] = 0;
            }

            for (int i = 2; i < s.length(); i++) {
                if (t2[i] == t2[i-1]) {
                    if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    }

                count2++;
                }
            }
        } count2++ count2 if (t2[0] == 0) {
                t2[0] = 1;
            } else {
                t2[0] = 0;
            } t2[0] == 0 t2[0] t2 0 0 {
                t2[0] = 1;
            } t2[0] = 1 t2[0] t2 0 1 {
                t2[0] = 0;
            } t2[0] = 0 t2[0] t2 0 0 for (int i = 2; i < s.length(); i++) {
                if (t2[i] == t2[i-1]) {
                    if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    }

                count2++;
                }
            } int i = 2; int i = 2; i 2 i < s.length() i s.length() s.length s i++ i++ i {
                if (t2[i] == t2[i-1]) {
                    if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    }

                count2++;
                }
            } {
                if (t2[i] == t2[i-1]) {
                    if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    }

                count2++;
                }
            } if (t2[i] == t2[i-1]) {
                    if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    }

                count2++;
                } t2[i] == t2[i-1] t2[i] t2 i t2[i-1] t2 i-1 i 1 {
                    if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    }

                count2++;
                } if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    } t2[i] == 0 t2[i] t2 i 0 {
                        t2[i] = 1;
                    } t2[i] = 1 t2[i] t2 i 1 {
                        t2[i] = 0;
                    } t2[i] = 0 t2[i] t2 i 0 count2++ count2 if (count2 > 0) {
            if (count < count2) {
                System.out.println(count);
            } else {
                System.out.println(count2);
            }
        } else {
            System.out.println(count);
        } count2 > 0 count2 0 {
            if (count < count2) {
                System.out.println(count);
            } else {
                System.out.println(count2);
            }
        } if (count < count2) {
                System.out.println(count);
            } else {
                System.out.println(count2);
            } count < count2 count count2 {
                System.out.println(count);
            } System.out.println(count) System.out.println System.out System System.out count {
                System.out.println(count2);
            } System.out.println(count2) System.out.println System.out System System.out count2 {
            System.out.println(count);
        } System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int count = 0;
        int t[] = new int[s.length()];
        int t2[] = new int[s.length()];

		for (int i = 0; i < s.length(); i++) {
            t[i] = Integer.parseInt(s.substring(i, i+1));
            t2[i] = t[i];
		}

		for (int i = 1; i < s.length(); i++) {
			if (t[i] == t[i-1]) {
				if (t[i] == 0) {
					t[i] = 1;
				} else {
					t[i] = 0;
				}
				count++;
			}
        }
        
        int count2 = 0;
        if (s.length() >= 2 && t2[0] == t2[1]) {
            count2++;
            if (t2[0] == 0) {
                t2[0] = 1;
            } else {
                t2[0] = 0;
            }

            for (int i = 2; i < s.length(); i++) {
                if (t2[i] == t2[i-1]) {
                    if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    }

                count2++;
                }
            }
        }

        if (count2 > 0) {
            if (count < count2) {
                System.out.println(count);
            } else {
                System.out.println(count2);
            }
        } else {
            System.out.println(count);
        }
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int count = 0;
        int t[] = new int[s.length()];
        int t2[] = new int[s.length()];

		for (int i = 0; i < s.length(); i++) {
            t[i] = Integer.parseInt(s.substring(i, i+1));
            t2[i] = t[i];
		}

		for (int i = 1; i < s.length(); i++) {
			if (t[i] == t[i-1]) {
				if (t[i] == 0) {
					t[i] = 1;
				} else {
					t[i] = 0;
				}
				count++;
			}
        }
        
        int count2 = 0;
        if (s.length() >= 2 && t2[0] == t2[1]) {
            count2++;
            if (t2[0] == 0) {
                t2[0] = 1;
            } else {
                t2[0] = 0;
            }

            for (int i = 2; i < s.length(); i++) {
                if (t2[i] == t2[i-1]) {
                    if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    }

                count2++;
                }
            }
        }

        if (count2 > 0) {
            if (count < count2) {
                System.out.println(count);
            } else {
                System.out.println(count2);
            }
        } else {
            System.out.println(count);
        }
	}
} Main
import java.util.*;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int count = 0;
        int t[] = new int[s.length()];
        int t2[] = new int[s.length()];

		for (int i = 0; i < s.length(); i++) {
            t[i] = Integer.parseInt(s.substring(i, i+1));
            t2[i] = t[i];
		}

		for (int i = 1; i < s.length(); i++) {
			if (t[i] == t[i-1]) {
				if (t[i] == 0) {
					t[i] = 1;
				} else {
					t[i] = 0;
				}
				count++;
			}
        }
        
        int count2 = 0;
        if (s.length() >= 2 && t2[0] == t2[1]) {
            count2++;
            if (t2[0] == 0) {
                t2[0] = 1;
            } else {
                t2[0] = 0;
            }

            for (int i = 2; i < s.length(); i++) {
                if (t2[i] == t2[i-1]) {
                    if (t2[i] == 0) {
                        t2[i] = 1;
                    } else {
                        t2[i] = 0;
                    }

                count2++;
                }
            }
        }

        if (count2 > 0) {
            if (count < count2) {
                System.out.println(count);
            } else {
                System.out.println(count2);
            }
        } else {
            System.out.println(count);
        }
	}
}
