a=list(map(int,input().split()))

a=sorted(a)

cnt=0

if a[0]==a[1] and a[1]==a[2]:

	print((0))

elif a[0]==a[1]:

	while True:

		a[0]+=1

		a[1]+=1

		cnt+=1

		if a[0]==a[2]:

			print(cnt)

			break

elif a[1]==a[2]:

	while True:

		a[0]+=2

		cnt+=1

		if a[0]==a[2]:

			print(cnt)

			break

		elif a[0]>a[2]:

			print((cnt+1))

			break

else:

	while True:

		a[0]+=1

		a[1]+=1

		cnt+=1

		if a[2]==a[1]:

			break

	while True:

		a[0]+=2

		cnt+=1

		if a[0]==a[2]:

			print(cnt)

			break

		elif a[0]>a[2]:

			print((cnt+1))

			break
a=list(map(int,input().split()))

a.sort()

b=a[2]-a[1]

c=a[2]-a[0]

if (b+c)%2==0:

	print(((b+c)//2))

else:

	print((((b+c)//2)+2))
a = list(map(int, input().split()))
a = sorted(a)
cnt = 0
if a[0] == a[1] and a[1] == a[2]:
    print((0))
elif a[0] == a[1]:
    while True:
        a[0] += 1
        a[1] += 1
        cnt += 1
        if a[0] == a[2]:
            print(cnt)
            break
elif a[1] == a[2]:
    while True:
        a[0] += 2
        cnt += 1
        if a[0] == a[2]:
            print(cnt)
            break
        elif a[0] > a[2]:
            print((cnt + 1))
            break
else:
    while True:
        a[0] += 1
        a[1] += 1
        cnt += 1
        if a[2] == a[1]:
            break
    while True:
        a[0] += 2
        cnt += 1
        if a[0] == a[2]:
            print(cnt)
            break
        elif a[0] > a[2]:
            print((cnt + 1))
            break

a = list(map(int, input().split()))
a.sort()
b = a[2] - a[1]
c = a[2] - a[0]
if (b + c) % 2 == 0:
    print(((b + c) // 2))
else:
    print((((b + c) // 2) + 2))

-a = sorted(a) -cnt = 0 -if a[0] == a[1] and a[1] == a[2]: -    print((0)) -elif a[0] == a[1]: -    while True: -        a[0] += 1 -        a[1] += 1 -        cnt += 1 -        if a[0] == a[2]: -            print(cnt) -            break -elif a[1] == a[2]: -    while True: -        a[0] += 2 -        cnt += 1 -        if a[0] == a[2]: -            print(cnt) -            break -        elif a[0] > a[2]: -            print((cnt + 1)) -            break +a.sort() +b = a[2] - a[1] +c = a[2] - a[0] +if (b + c) % 2 == 0: +    print(((b + c) // 2)) -    while True: -        a[0] += 1 -        a[1] += 1 -        cnt += 1 -        if a[2] == a[1]: -            break -    while True: -        a[0] += 2 -        cnt += 1 -        if a[0] == a[2]: -            print(cnt) -            break -        elif a[0] > a[2]: -            print((cnt + 1)) -            break +    print((((b + c) // 2) + 2))