#!/usr/bin/env python3

#最終上体がわかれば回数fin*3 - (a+b+c) //2

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

a.sort()

# maxがfinにならないのは、a[0]-1[1]が奇数の時

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

    print(((a[-1]*3-sum(a))//2))

else:

    print(((a[-1]*3+3-sum(a))//2))

"""

x = a[-1]-a[1]

y = a[1] -a[0]

def dist(n):

    if n % 2 == 0: return n//2

    else: return n//2+2

print(min(2*x+y,dist(y)+x,dist(x+y)+dist(x)))"""
a, b, c = list(map(int, input().split()))

s = [a, b, c]

s.sort()

if (s[2] * 2 - s[0] - s[1]) % 2 == 0:

    print(((3 * s[2] - sum(s)) // 2))

else:

    print(((3 * s[2] + 3 - sum(s)) // 2))



#!/usr/bin/env python3
# 最終上体がわかれば回数fin*3 - (a+b+c) //2
a = list(map(int, input().split()))
a.sort()
# maxがfinにならないのは、a[0]-1[1]が奇数の時
if (a[1] - a[0]) % 2 == 0:
    print(((a[-1] * 3 - sum(a)) // 2))
else:
    print(((a[-1] * 3 + 3 - sum(a)) // 2))
"""
x = a[-1]-a[1]
y = a[1] -a[0]
def dist(n):
    if n % 2 == 0: return n//2
    else: return n//2+2
print(min(2*x+y,dist(y)+x,dist(x+y)+dist(x)))"""

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

-#!/usr/bin/env python3 -# 最終上体がわかれば回数fin*3 - (a+b+c) //2 -a = list(map(int, input().split())) -a.sort() -# maxがfinにならないのは、a[0]-1[1]が奇数の時 -if (a[1] - a[0]) % 2 == 0: -    print(((a[-1] * 3 - sum(a)) // 2)) +a, b, c = list(map(int, input().split())) +s = [a, b, c] +s.sort() +if (s[2] * 2 - s[0] - s[1]) % 2 == 0: +    print(((3 * s[2] - sum(s)) // 2)) -    print(((a[-1] * 3 + 3 - sum(a)) // 2)) -""" -x = a[-1]-a[1] -y = a[1] -a[0] -def dist(n): -    if n % 2 == 0: return n//2 -    else: return n//2+2 -print(min(2*x+y,dist(y)+x,dist(x+y)+dist(x)))""" +    print(((3 * s[2] + 3 - sum(s)) // 2))