S = eval(input())

def func():

    from collections import Counter as c

    ev,od = [],[]

    for i in range(len(S)):

        ev.append(S[i]) if i%2 == 0 else 0

        od.append(S[i]) if i%2 == 1 else 0

    ev = c(ev).most_common()

    od = c(od).most_common()

    if len(od) == 0:

        return 0

    if ev[0][0] != od[0][0]:

        return len(S)-ev[0][1]-od[0][1]

    else:

        if len(ev) == len(od) == 1:

            return len(S)//2

        else:

            return min(len(S)-ev[0][1]-od[-1][1],len(S)-ev[-1][1]-od[0][1])

print((func()))
S = eval(input())

ans0 = 0

ans1 = 0

for i in range(len(S)):

    if i%2 == 0:

        if S[i] == '0':

            ans1 += 1

        else:

            ans0 += 1

    else:

        if S[i] == '1':

            ans1 += 1

        else:

            ans0 += 1

print((min(ans0,ans1)))
S = eval(input())


def func():
    from collections import Counter as c

    ev, od = [], []
    for i in range(len(S)):
        ev.append(S[i]) if i % 2 == 0 else 0
        od.append(S[i]) if i % 2 == 1 else 0
    ev = c(ev).most_common()
    od = c(od).most_common()
    if len(od) == 0:
        return 0
    if ev[0][0] != od[0][0]:
        return len(S) - ev[0][1] - od[0][1]
    else:
        if len(ev) == len(od) == 1:
            return len(S) // 2
        else:
            return min(len(S) - ev[0][1] - od[-1][1], len(S) - ev[-1][1] - od[0][1])


print((func()))

S = eval(input())
ans0 = 0
ans1 = 0
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "0":
            ans1 += 1
        else:
            ans0 += 1
    else:
        if S[i] == "1":
            ans1 += 1
        else:
            ans0 += 1
print((min(ans0, ans1)))

- - -def func(): -    from collections import Counter as c - -    ev, od = [], [] -    for i in range(len(S)): -        ev.append(S[i]) if i % 2 == 0 else 0 -        od.append(S[i]) if i % 2 == 1 else 0 -    ev = c(ev).most_common() -    od = c(od).most_common() -    if len(od) == 0: -        return 0 -    if ev[0][0] != od[0][0]: -        return len(S) - ev[0][1] - od[0][1] +ans0 = 0 +ans1 = 0 +for i in range(len(S)): +    if i % 2 == 0: +        if S[i] == "0": +            ans1 += 1 +        else: +            ans0 += 1 -        if len(ev) == len(od) == 1: -            return len(S) // 2 +        if S[i] == "1": +            ans1 += 1 -            return min(len(S) - ev[0][1] - od[-1][1], len(S) - ev[-1][1] - od[0][1]) - - -print((func())) +            ans0 += 1 +print((min(ans0, ans1)))