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

m = max(a, b, c)

for i in range(100000):

        mod1 = 3*(m + i) % 2

        mod2 = (a + b + c) % 2

        if mod1 == mod2:

                print(((3*(m + i) - (a + b + c))//2))

                exit()
import math

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

l.sort()

a, b, c = l[0], l[1], l[2]



if (b-a)%2 == 0:

    ans = c-b+(b-a)//2

else:

    ans = c-b+math.ceil((b-a)/2) + 1

print(ans)
a, b, c = list(map(int, input().split()))
m = max(a, b, c)
for i in range(100000):
    mod1 = 3 * (m + i) % 2
    mod2 = (a + b + c) % 2
    if mod1 == mod2:
        print(((3 * (m + i) - (a + b + c)) // 2))
        exit()

import math

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

-a, b, c = list(map(int, input().split())) -m = max(a, b, c) -for i in range(100000): -    mod1 = 3 * (m + i) % 2 -    mod2 = (a + b + c) % 2 -    if mod1 == mod2: -        print(((3 * (m + i) - (a + b + c)) // 2)) -        exit() +import math + +l = list(map(int, input().split())) +l.sort() +a, b, c = l[0], l[1], l[2] +if (b - a) % 2 == 0: +    ans = c - b + (b - a) // 2 +else: +    ans = c - b + math.ceil((b - a) / 2) + 1 +print(ans)