import sys

def input(): return sys.stdin.readline().strip()



def resolve():

    s=eval(input())

    x=len(s)//2

    l1=[1,0]*x+[1]

    l2=[0,1]*x+[0]

    cnt1=0

    cnt2=0

    for i in range(len(s)):

        if s[i]!=str(l1[i]):

            cnt1+=1

        if s[i]!=str(l2[i]):

            cnt2+=1

    print((min(cnt1,cnt2)))

resolve()
import sys

def input(): return sys.stdin.readline().strip()



def resolve():

    s=eval(input())

    x=len(s)//2

    l1='10'*x+'1'

    l2='01'*x+'0'

    cnt1=0

    cnt2=0

    for i in range(len(s)):

        if s[i]!=l1[i]:

            cnt1+=1

        if s[i]!=l2[i]:

            cnt2+=1

    print((min(cnt1,cnt2)))

resolve()
import sys


def input():
    return sys.stdin.readline().strip()


def resolve():
    s = eval(input())
    x = len(s) // 2
    l1 = [1, 0] * x + [1]
    l2 = [0, 1] * x + [0]
    cnt1 = 0
    cnt2 = 0
    for i in range(len(s)):
        if s[i] != str(l1[i]):
            cnt1 += 1
        if s[i] != str(l2[i]):
            cnt2 += 1
    print((min(cnt1, cnt2)))


resolve()

import sys


def input():
    return sys.stdin.readline().strip()


def resolve():
    s = eval(input())
    x = len(s) // 2
    l1 = "10" * x + "1"
    l2 = "01" * x + "0"
    cnt1 = 0
    cnt2 = 0
    for i in range(len(s)):
        if s[i] != l1[i]:
            cnt1 += 1
        if s[i] != l2[i]:
            cnt2 += 1
    print((min(cnt1, cnt2)))


resolve()

-    l1 = [1, 0] * x + [1] -    l2 = [0, 1] * x + [0] +    l1 = "10" * x + "1" +    l2 = "01" * x + "0" -        if s[i] != str(l1[i]): +        if s[i] != l1[i]: -        if s[i] != str(l2[i]): +        if s[i] != l2[i]: