#https://atcoder.jp/contests/abc093/tasks/arc094_a



import numpy

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

cost = 0



max_index = numpy.argmax(data)

m = data.pop(max_index)

if abs(data[0]-data[1])%2 == 1:

    cost += 2

cost += (abs(data[0]-data[1])//2 + m - max(data))

print(cost)

#https://atcoder.jp/contests/abc093/tasks/arc094_a



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



diff = 3*max(a, b, c) - (a + b + c)



if diff%2 == 1:

    print((diff//2+2))

else:

    print((diff//2))

# https://atcoder.jp/contests/abc093/tasks/arc094_a
import numpy

data = list(map(int, input().split()))
cost = 0
max_index = numpy.argmax(data)
m = data.pop(max_index)
if abs(data[0] - data[1]) % 2 == 1:
    cost += 2
cost += abs(data[0] - data[1]) // 2 + m - max(data)
print(cost)

# https://atcoder.jp/contests/abc093/tasks/arc094_a
a, b, c = list(map(int, input().split()))
diff = 3 * max(a, b, c) - (a + b + c)
if diff % 2 == 1:
    print((diff // 2 + 2))
else:
    print((diff // 2))

-import numpy - -data = list(map(int, input().split())) -cost = 0 -max_index = numpy.argmax(data) -m = data.pop(max_index) -if abs(data[0] - data[1]) % 2 == 1: -    cost += 2 -cost += abs(data[0] - data[1]) // 2 + m - max(data) -print(cost) +a, b, c = list(map(int, input().split())) +diff = 3 * max(a, b, c) - (a + b + c) +if diff % 2 == 1: +    print((diff // 2 + 2)) +else: +    print((diff // 2))