import sys
#import numpy as np
import math
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
from fractions  import gcd

#input=sys.stdin.readline

s=list(map(int,input()))
n=len(s)
n0=n1=0
for i in range(n):
    if s[i]==1:
        n1+=1
    else:
        n0+=1
print(n-max(n0,n1)+min(n0,n1)) import sys sys import math math from collections import deque from fractions  import gcd s=list(map(int,input())) s list(map(int,input())) list map(int,input()) map int input() input n=len(s) n len(s) len s n0=n1=0 n0 0 =n1=0 n1 0 for i in range(n):
    if s[i]==1:
        n1+=1
    else:
        n0+=1 i range(n) range n if s[i]==1:
        n1+=1
    else:
        n0+=1 s[i]==1 s[i] s i 1 n1+=1 n1 1 n0+=1 n0 1 print(n-max(n0,n1)+min(n0,n1)) print n-max(n0,n1)+min(n0,n1) n-max(n0,n1) n max(n0,n1) max n0 n1 min(n0,n1) min n0 n1 n1+=1 1 n1 n1=0 0 n1 n=len(s) len(s) n n0=n1=0 0 n0 s=list(map(int,input())) list(map(int,input())) s n0+=1 1 n0
import sys
#import numpy as np
import math
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
from fractions  import gcd

#input=sys.stdin.readline

s=list(map(int,input()))
n=len(s)
n0=n1=0
for i in range(n):
    if s[i]==1:
        n1+=1
    else:
        n0+=1
print(n-max(n0,n1)+min(n0,n1))