CodeEff/ECCO huggingface dataset:
# Original solution
a,b,c=list(map(int,input().split()))
total=a+b+c
m=max(a,b,c)
if total%2==0:
    if m%2==0:
        print(((3*m-total)//2))
    else:
        m=m+1
        print(((3*m-total)//2))
else:
    if m%2==0:
        m=m+1
        print(((3*m-total)//2))
    else:
        print(((3*m-total)//2))

# Optimized solution
a,b,c=list(map(int,input().split()))
m=max(a,b,c)
total=a+b+c
x=0
if m%2==0 and total%2==0:
    print(((3*m-total)//2))
elif m%2==1 and total%2==1:
    print(((3*m-total)//2))
else:
    m=m+1
    print(((3*m-total)//2))
# Original solution
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    a,b,c = readInts()
    if (max(a,b,c)*3 - a - b - c) % 2 == 0:# 3 4 5  5 * 3 = 15 15 - 12 = 3
        print(((max(a,b,c)*3 - a - b - c)//2))
    else:
        print((((max(a,b,c)*3 - a - b - c) //2)+2)) # 3 4 5 (1+2) 
if __name__ == '__main__':
  main()


# Optimized solution
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    a,b,c = readInts()
    # 二つの構成で、合計結局偶数個増えることが分かる
    d = max(a,b,c)*3 - a - b - c
    if d % 2 == 0:
        # 偶数なら、
        print((d//2))
        # 1回で2個
    else:#奇数なら、
        print((d//2 + 2))
        # 条件1, 条件2を結局1回ずつ増やす
if __name__ == '__main__':
  main()
# Original solution
a,b,c = list(map(int,input().split()))
d = [a,b,c]
d.sort()
x,y = d[:-1]
m = d[-1]

cnt = m-y
x += cnt
y += cnt
if (y-x) % 2 == 1:
    cnt += (y+1-x)//2 + 1
else:
    cnt += (y-x)//2
    
print(cnt)

# Optimized solution
a,b,c = list(map(int,input().split()))
s = sorted([a,b,c])
x,y = s[:-1]
m = s[-1]

xym = m-x + m-y
if xym % 2 == 0:
    print((xym//2))
else:
    print((xym//2+2))
# Original solution
N = list(map(int,input().split()))
N.sort()
A = N[0]
B = N[1]
C = N[2]
ans = 0
if max(N) == min(N):
  print(ans)
  exit()
if (B-A)%2 == 0:
  ans += (B-A)//2 + C - B
else:
  ans += 1
  B += 1
  C += 1
  ans += (B-A)//2 + C - B
  
print(ans)
  

# Optimized solution
L = list(map(int,input().split()))
L.sort()
ans = 0
if (L[1] - L[0]) % 2 == 0:
    ans += (L[1] - L[0]) // 2
    ans += L[2] - L[1]
else:
    ans += 1
    L[0] += 1
    L[2] += 1
    ans += (L[1] - L[0]) // 2
    ans += L[2] - L[1]
print(ans)
# Original solution
L = list(map(int, input().split()))
L.sort()

ans = 0
ans += L[2]-L[1]
L[0] += L[2]-L[1]
L[1] = L[2]

if (L[2]-L[0])%2 == 0:
    ans += (L[2]-L[0])//2
else:
    ans += 1+(L[2]+1-L[0])//2

print(ans)


# Optimized solution
L = list(map(int, input().split()))
L.sort()

ans = L[2]-L[1]
L[0] = L[0]+ L[2]-L[1]
L[1] = L[2]
if L[0]%2 == L[2]%2:
    ans += (L[2]-L[0])//2
else:
    ans += 1 + (L[2]+1-L[0])//2
print(ans)
# Original solution
abc = sorted(list(map(int, input().split())))

if (abc[0]%2==0 and abc[1]%2==0) or (abc[0]%2==1 and abc[1]%2==1):
  ans = 0
  ans += abc[2]-abc[1]
  ans += (abc[1]-abc[0])//2
  print(ans)
else:
  count = 0
  for i in abc:
    if i%2 == 0: count+=1

  for i in range(len(abc)):
    if count == 2:
      if abc[i]%2 == 0: abc[i] += 1
    else:
      if abc[i]%2 == 1: abc[i] += 1
  ans = 1
  ans += abc[2]-abc[1]
  ans += (abc[1]-abc[0])//2
  print(ans)

# Optimized solution
abc = sorted(list(map(int, input().split())))

ans = 0
ans += abc[2]-abc[1]
abc[0] += abc[2]-abc[1]
abc[1] += abc[2]-abc[1]

if (abc[2]-abc[0])%2 == 1:
  abc[1] += 1
  abc[2] += 1
  ans += 1

ans += (abc[2]-abc[0])//2
print(ans)
# Original solution
abc = sorted(list(map(int, input().split())))

ans = 0
ans += abc[2]-abc[1]
abc[0] += abc[2]-abc[1]
abc[1] += abc[2]-abc[1]

if (abc[2]-abc[0])%2 == 1:
  abc[1] += 1
  abc[2] += 1
  ans += 1

ans += (abc[2]-abc[0])//2
print(ans)

# Optimized solution
abc = sorted(list(map(int, input().split())))

ans = 0
if (abc[1]-abc[0])%2 == 1:
  ans += 1
  abc[1] += 1
  abc[2] += 1

ans += (abc[1]-abc[0])//2
abc[0] += abc[1]-abc[0]
ans += abc[2]-abc[1]
print(ans)
# Original solution

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

x.sort()
count=0

x[0]=x[2]-x[0]
x[1]=x[2]-x[1]


while not(x[0]==1 or x[0]==2):
    x[0]=x[0]-2
    count+=1

while not(x[1]==1 or x[1]==2):
    x[1]=x[1]-2
    count+=1

if (x[0]==1 and x[1]==1):
    print((count+1))
    quit()

if (x[0]==2 and x[1]==2):
    print((count+2))
    quit()

if (x[0]*x[1]==2):
    print((count+3))
    quit()

# Optimized solution
x = list(map(int, input().split()))

x.sort()
count=0

x[0]=x[2]-x[0]
x[1]=x[2]-x[1]

if x[0]%2==0:
    count+=int(x[0]/2)-1
    x[0]=2
else:
    count+=int(x[0]/2)
    x[0]=1
    
if x[1]%2==0:
    count+=int(x[1]/2)-1
    x[1]=2
else:
    count+=int(x[1]/2)
    x[1]=1

if (x[0]==1 and x[1]==1):
    print((count+1))
    quit()

if (x[0]==2 and x[1]==2):
    print((count+2))
    quit()

if (x[0]*x[1]==2):
    print((count+3))
    quit()
# Original solution
A,B,C = list(map(int,input().split()))
maxi = max(A,B,C)
mini = min(A,B,C)
mid = sum([A,B,C]) - (maxi+mini)
i,j,k,l = 0,0,0,0
if mini%2 != mid%2:
    #midだけ偶奇が違うとき
    if maxi%2 == mini%2 and maxi%2 != mid%2:
        while mid - maxi != 1:
            mid += 2
            i += 1
    #miniだけ偶奇が違うとき
    if maxi%2 != mini%2 and maxi%2 == mid%2:
        while mini - maxi != 1:
            mid += 2
            j += 1
while maxi - mini > 1:
    mini += 2
    k += 1
while maxi - mid > 1:
    mid += 2
    l += 1
if maxi == mini and maxi == mid:
    print((i+j+k+l))
else:
    print((i+j+k+l+1))

# Optimized solution
A,B,C = list(map(int,input().split()))
maxi = max(A,B,C)
mini = min(A,B,C)
mid = sum([A,B,C]) - (maxi+mini)
i,j,k,l = 0,0,0,0
if mini%2 != mid%2:
    #midだけ偶奇が違うとき
    if maxi%2 == mini%2 and maxi%2 != mid%2:
        if mid - maxi != 1:
            i = (maxi+1-mid)//2
            mid = maxi + 1
    #miniだけ偶奇が違うとき
    if maxi%2 != mini%2 and maxi%2 == mid%2:
        if mini - maxi != 1:
            j = (maxi+1-mini)//2
            mini = maxi + 1
while maxi - mini > 1:
    mini += 2
    k += 1
while maxi - mid > 1:
    mid += 2
    l += 1
if maxi == mini and maxi == mid:
    print((i+j+k+l))
else:
    print((i+j+k+l+1))
# Original solution
a,b,c=list(map(int,input().split()))
s=max(a,b,c)
ans=3*s-a-b-c
if ans&1:ans+=3
print((ans//2))

# Optimized solution
a,b,c=list(map(int,input().split()))
m=max(a,b,c)
n=m-a+m-b+m-c
if n%2==1:print((n//2+2))
else:print((n//2))
# Original solution
import sys
input = sys.stdin.readline

def main():
    li = list(map(int, input().split()))

    max_n = max(li)
    max_i = li.index(max_n)

    diff = 0

    for i in range(3):
        if i == max_i:
            continue

        diff += max_n - li[i]

    if diff % 2 == 0:
        print((diff//2))
    else:
        print(((diff+1)//2 + 1))


if __name__ == '__main__':
    main()


# Optimized solution
li = list(map(int, input().split()))

sum_li = sum(li)

max_li = max(li)

j = 3 * max_li - sum_li

if j % 2 == 0:
    ans = j // 2
else:
    ans = (j + 3) // 2

print(ans)
# Original solution
a = list(map(int, input().split()))
n = []
for i in range(len(a)):
  if a[i] % 2 == 0: n.append(i+1)
if len(n) == 3:
  a.sort()
  ans = (a[2]-a[0]) // 2 + (a[2] - a[1]) // 2
elif len(n) == 2:
  N = 3 - sum(n) - 1 #奇数
  ans = 0
  if a[N] != max(a):
    while a[N] < max(a):
      a[N] += 2
      ans += 1
  a.sort()
  ans += (a[1] - a[0]) // 2 + a[2] - a[1]
elif len(n) == 1:
  for i in range(len(a)):
    if a[i] % 2 != 0:
      a[i] += 1
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1
else:
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
print(ans)

# Optimized solution
a = list(map(int, input().split()))
n = []
for i in range(len(a)):
  if a[i] % 2 == 0: n.append(i+1)
if len(n) == 3:
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
elif len(n) == 2:
  N = 3 - sum(n) - 1 #奇数のインデックス
  ans = 0
  if a[N] != max(a):
    while a[N] < max(a):
      a[N] += 2
      ans += 1
  a.sort()
  ans += (a[1] - a[0]) // 2 + a[2] - a[1]
elif len(n) == 1:
  for i in range(len(a)):
    if a[i] % 2 != 0:
      a[i] += 1
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1
else:
  a.sort()
  ans = (a[2] - a[0]) // 2 + (a[2] - a[1]) // 2
print(ans)
# Original solution
abc = list(map(int, input().split()))
abc.sort()
ans = 0
cnt = 0
rest = 0
for i in range(3):
    if abc[i] % 2 == 0:
        cnt += 1
if cnt == 0 or cnt == 3:
    print(((abc[2] - abc[1]) // 2 + (abc[2] - abc[0]) // 2))
    exit()
elif cnt == 1:
    rest = 1
for i in range(3):
    if abc[i] % 2 == rest:
        abc[i] += 1
abc.sort()
print(((abc[2] - abc[1]) // 2 + (abc[2] - abc[0]) // 2 + 1))

# Optimized solution
a, b, c = list(map(int, input().split()))
x = max(a, b, c)
total = a + b + c
if x % 2 != total % 2:
    x += 1
print(((3 * x - total) // 2))
# Original solution
# 1. 3つとも違う数字
#  => 小さいふたつを + 1
# 2. 2つ同じ数字
#  => 1つだけの数字が小さい
#     小さい数字を + 2
#  => 1つだけの数字が大きい
#     小さいふたつを + 1
a, b, c = list(map(int, input().split()))
result = 0
while True:
  if a == b and b == c:
    break
  elif a != b and b != c and a != c:
    if a < b:
      if b < c:
        a += 1
        b += 1
      else:
        a += 1
        c += 1
    else:
      if a < c:
        a += 1
        b += 1
      else:
        b += 1
        c += 1
  else:
    if a == b:
      if a > c:
        c += 2
      else:
        a += 1
        b += 1
    elif b == c:
      if a > b:
        b += 1
        c += 1
      else:
        a += 2
    else:
      # a == c
      if a > b:
        b += 2
      else:
        a += 1
        c += 1
  result += 1
print(result)


# Optimized solution
A, B, C = list(map(int, input().split()))

# 1. 3つとも違う数字
#  => 小さいふたつを + 1
# 2. 2つ同じ数字
#  => 1つだけの数字が小さい
#     小さい数字を + 2
#  => 1つだけの数字が大きい
#     小さいふたつを + 1
result = 0
while True:
    if A == B and B == C:
        break
    elif A != B and B != C and A != C:
        if A < B:
            if B < C:
                A += 1
                B += 1
            else:
                A += 1
                C += 1
        else:
            if A < C:
                A += 1
                B += 1
            else:
                B += 1
                C += 1
    else:
        if A == B:
            if A > C:
                C += 2
            else:
                A += 1
                B += 1
        elif B == C:
            if A > B:
                B += 1
                C += 1
            else:
                A += 2
        else:
            # A == C
            if A > B:
                B += 2
            else:
                A += 1
                C += 1
    result += 1
print(result)
# Original solution
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()

# Optimized solution
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)
# Original solution
a=list(map(int,input().split()))
s=max(a)*3-sum(a);print(([s//2+2,s//2][s%2<1]))

# Optimized solution
a,b,c=sorted(map(int,input().split()))
print((c-b+(b-a+1)//2+((b-a)&1)))
# Original solution
A,B,C = list(map(int,input().split()))
 
counter = 0
 
while not A == B == C:
    if max([A,B,C])-min([A,B,C]) > 1:
        if A < B and A < C:
            A += 2
        elif B < A and B < C:
            B += 2
        else:
            C += 2
        counter += 1
    else:
        if A < C and B < C:
            A += 1
            B += 1
        elif A < B and C < B:
            A += 1
            C += 1
        else:
            B += 1
            C += 1
        counter += 1
        
print(counter)

# Optimized solution
A,B,C = list(map(int,input().split()))
 
counter = 0
 
while not A == B == C:
    A,B,C = sorted([A,B,C])
    if C - A > 1:
        A += 2
        counter += 1
    else:
        A += 1
        B += 1
        counter += 1
        
print(counter)
# Original solution
#!/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)))"""

# Optimized solution
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))
# Original solution
n_list = list(map(int,input().split()))
n_list.sort()
num = 2 * n_list[2]
dummy = num - (n_list[0] + n_list[1])
a,b = divmod(dummy,2)
if b == 0:
  print(a)
else:
  print((a+2))

# Optimized solution
n_list = list(map(int,input().split()))
n_list.sort()
num = 2 * n_list[2]
dummy = num - (n_list[0] + n_list[1])
#print(dummy)
a,b = divmod(dummy,2)
if b == 0:
  print(a)
else:
  print((a+2))
# Original solution
a=list(map(int,input().split()))
a.sort()
cnt=0
while(a[1]!=a[2]):
        a[0]+=1
        a[1]+=1
        cnt+=1
if a[1]==a[0]+1:
    a[1]+=1
    a[2]+=1
    cnt+=1
while(a[0]!=a[1]):
    a[0]+=2
    cnt+=1
print(cnt)

# Optimized solution
a=list(map(int,input().split()))
a.sort()
cnt=0
if a[1]!=a[2]:
    cnt=a[2]-a[1]
    a[0]+=cnt
    a[1]+=cnt
if 1==(a[1]-a[0])%2:
    a[1]+=1
    a[2]+=1
    cnt+=1
if a[0]!=a[1]:
    n=int((a[1]-a[0])/2)
    cnt+=n
    #a[0]+=(n*2)
print(cnt)
# Original solution
# -*- coding: utf-8 -*-

def count(data):
    even = odd = 0
    for val in data:
        if val % 2 == 0:
            even += 1
        else:
            odd += 1

    return even,odd

A,B,C = list(map(int, input().split()))

ans = 0
even,odd = count([A, B, C])
if even == 2:
    ans += 1
    if A % 2 == 0:
        A += 1
    if B % 2 == 0:
        B += 1
    if C % 2 == 0:
        C += 1
elif odd == 2:
    ans += 1
    if A % 2 != 0:
        A += 1
    if B % 2 != 0:
        B += 1
    if C % 2 != 0:
        C += 1

max_val = max(A,B,C)

ans += (max_val - A) / 2
ans += (max_val - B) / 2
ans += (max_val - C) / 2
print((int(ans)))


# Optimized solution
# -*- coding: utf-8 -*-

A,B,C = list(map(int, input().split()))

s = A + B + C
M = max(A,B,C)
if M % 2 == 0 and s % 2 != 0:
    M += 1
elif M % 2 != 0 and s % 2 == 0:
    M += 1

ans = (3 * M - s) / 2
print((int(ans)))
# Original solution
a = sorted(list(map(int, input().split())))

s = sum(a)
if s%2==a[2]%2:
  if a[2]%2==a[1]%2:
    print(((a[2]-a[1])//2+(a[2]-a[0])//2))
  else:
    a[1] += 1
    a[0] += 1
    print(((a[2]-a[1])//2+(a[2]-a[0])//2+1))
else:
  a[2] += 1
  a[1] += 1
  if a[2]%2==a[1]%2:
    print(((a[2]-a[1])//2+(a[2]-a[0])//2+1))
  else:
    a[1] += 1
    a[0] += 1
    print(((a[2]-a[1])//2+(a[2]-a[0])//2+2))

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

res1 = a+b+c
res2 = max(a, b, c)*3
if (res2-res1)%2==0:
  print(((res2-res1)//2))
else:
  res3 = (max(a, b, c)+1)*3
  print(((res3-res1)//2))
# Original solution
a, b, c = list(map(int, input().split()))

res1 = a+b+c
res2 = max(a, b, c)*3
if (res2-res1)%2==0:
  print(((res2-res1)//2))
else:
  res3 = (max(a, b, c)+1)*3
  print(((res3-res1)//2))

# Optimized solution
a,b,c=list(map(int,input().split()))
d=max(a,b,c)
s=a+b+c
if d%2==0 and s%2==0:
  print(((3*d-a-b-c)//2))
elif d%2==1 and s%2==1:
  print(((3*d-a-b-c)//2))
else:
  print(((3*(d+1)-a-b-c)//2))
# Original solution
a,b,c=list(map(int, input().split(" ")))
ans=0
while not a==b==c:
    if (a==b or b==c or c==a):
        if a==b and a<c:
            a += 1
            b += 1
            ans += 1
        elif a==b and a>c:
            c += 2
            ans += 1
        elif a == c and a < b:
            c += 1
            a += 1
            ans += 1
        elif a == c and a > b:
            b += 2
            ans += 1
        elif b == c and a < b:
            a += 2
            ans += 1
        elif b == c and a < b:
            b += 1
            c += 1
            ans += 1
    else:
        if a<b and a<c:
            a+=2
            ans+=1
        elif b<c:
            b+=2
            ans+=1
        else:
            c+=2
            ans+=1
print(ans)

# Optimized solution
a,b,c=list(map(int, input().split(" ")))
ans=0
if (max(a,b,c)*3-a-b-c)%2==0:
    ans=int((max(a,b,c)*3-a-b-c)/2)
else:
    ans = ((max(a, b, c) * 3 - a - b - c) // 2)+2
print(ans)
# Original solution
import sys

def solve():
    input = sys.stdin.readline
    L = [int(i) for i in input().split()]
    L.sort()
    odd, even = 0, 0
    for l in L:
        if l % 2 == 0: even += 1
        else: odd += 1
    count = 0
    if even == 3 or odd == 3: count = 0
    elif even == 2:
        count += 1
        for i in range(3):
            if L[i] % 2 == 0: L[i] += 1
    elif odd == 2:
        count += 1
        for i in range(3):
            if L[i] % 2 == 1: L[i] += 1
    count += (L[2] - L[0]) // 2 + (L[2] - L[1]) // 2
    print(count)

    return 0

if __name__ == "__main__":
    solve()

# Optimized solution
import sys

def solve():
    input = sys.stdin.readline
    L = [int(i) for i in input().split()]
    count = 0
    L.sort()
    addMin = (L[2] - L[0]) // 2  
    addMid = (L[2] - L[1]) // 2
    count = addMin + addMid
    L[0] += addMin * 2
    L[1] += addMid * 2
    if L[0] < L[2] and L[1] < L[2]: print((count + 1))
    elif L[0] == L[1] == L[2]: print(count)
    else: print((count + 2))
    #print(L)

    return 0

if __name__ == "__main__":
    solve()
# Original solution
import sys
input = sys.stdin.readline

a = [int(x) for x in input().split()]
cnt = 0
a.sort()
cnt += a[-1] - a[1]
a[0] += cnt
if (a[-1] - a[0]) % 2 == 1:
    cnt += 1
    a[-1] += 1
cnt += (a[-1] - a[0]) // 2
print(cnt)    

# Optimized solution
import sys
input = sys.stdin.readline

a = [int(x) for x in input().split()]
a.sort()
ans = 0
ans += a[2] - a[1]
a[0] += ans
if (a[2] - a[0]) % 2 == 0:
    ans += (a[2] - a[0])//2
    print(ans)
else:
    ans += (a[2] - a[0])//2
    ans += 2
    print(ans)
# Original solution
L = sorted(list(map(int,input().split())))
A, B, C = L[0], L[1], L[2]
print((C-B+(B-A)//2+2*((B-A)%2)))


# Optimized solution
L = sorted(list(map(int,input().split())))
ans = 0
while L[0] != L[1] or L[1] != L[2]:
    ans += 1
    if L[0]+2 <= L[2]:
        L[0] += 2
    else:
        L[0] += 1
        L[1] += 1
    L = sorted(L)
print(ans)
# Original solution
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 20 22:44:27 2020

@author: liang
"""

A, B, C = list(map(int, input().split()))

if A > B:
    if B > C:
        m1,m2,m3 = A, B, C
    else:
        if A > C:
            m1,m2,m3 = A, C, B
        else:
            m1,m2,m3 = C, A, B
else:
    if A > C:
        m1,m2,m3 = B, A, C
    else:
        if B > C:
            m1,m2,m3 = B, C, A
        else:
            m1,m2,m3 = C, B, A
ans = 0
ans += m1 - m2
ans += (m2-m3)//2
if (m2-m3)%2 == 1:
    ans += 2
print(ans)

# Optimized solution
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 20 23:06:24 2020

@author: liang
"""
num = [int(x) for x in input().split()]
M = max(num)
S = sum(num)
if M*3%2 == S%2:
    print(((3*M-S)//2))
else:
    print(((3*(M+1)-S)//2))
# Original solution
A,B,C = list(map(int, input().split()))

cnt = 0
while A!=B or B!=C or C!=A:
    A,B,C = sorted([A,B,C])
    
    if A==B:
        A += 1
        B += 1
        cnt += 1
        
    else:
        A += 2
        cnt += 1
        
print(cnt)
        
    

# Optimized solution
A,B,C = list(map(int, input().split()))

ABC = [A,B,C]

ans = 0

while 1:
    ABC.sort()
    
    if ABC[0] == ABC[1] and ABC[1] == ABC[2]:
        break
    
    elif ABC[0] == ABC[1]:
        ABC[0]+=1
        ABC[1]+=1
        
        ans += 1
        
    else:
        ABC[0] += 2
        
        ans += 1
        
print(ans)
# Original solution
A = sorted(list(map(int, input().split())))
s = 0
for a in A[:-1]:
	s += A[-1] - a
print((s//2 + 2 if s % 2 else s//2))

# Optimized solution
A = sorted(list(map(int, input().split())))
d = max(A)*3 - sum(A)
print((d//2 + 2 if d % 2 else d//2))
# Original solution
A,B,C = sorted(list(map(int,input().split())))
if (B-A)%2==0 and (C-B)%2==0:
    cnt = (B-A)//2+C-B
elif (B-A)%2==0 and (C-B)%2==1:
    cnt = (B-A)//2+C-B
elif (B-A)%2==1 and (C-B)%2==0:
    cnt = 1+(B+1-A)//2+C-B
else:
    cnt = (B+1-A)//2+C+1-B
print(cnt)

# Optimized solution
A,B,C = sorted(list(map(int,input().split())))
cnt = 0
cnt += C-B
A += (C-B)
if (C-A)%2==1:
    cnt += 1
    C += 1
cnt += (C-A)//2
print(cnt)
# Original solution
A,B,C = sorted(list(map(int,input().split())))
cnt = 0
cnt += (C-A)//2
A += ((C-A)//2)*2
cnt += (C-B)//2
B += ((C-B)//2)*2
A,B,C = sorted([A,B,C])
if B==C:
    if A<C:
        cnt += 2
else:
    cnt += 1
print(cnt)

# Optimized solution
A,B,C = sorted(list(map(int,input().split())))
cnt = C-B
A = A+C-B
if (C-A)%2==0:
    cnt += (C-A)//2
else:
    cnt += 1+(C-A+1)//2
print(cnt)
# Original solution
A,B,C = sorted(list(map(int,input().split())))
cnt = C-B
A = A+C-B
if (C-A)%2==0:
    cnt += (C-A)//2
else:
    cnt += 1+(C-A+1)//2
print(cnt)

# Optimized solution
A = sorted(list(map(int,input().split())))
cnt = 0
n = (A[2]-A[0])//2
cnt += n
A[0] += 2*n
n = (A[2]-A[1])//2
cnt += n
A[1] += 2*n
A = sorted(A)
if A[0]<A[1]==A[2]:
    cnt += 2
elif A[0]==A[1]<A[2]:
    cnt += 1
print(cnt)
# Original solution
lis = list(map(int,input().split()))
cou = 0
lis.sort()
while lis[2] - lis[0] > 1:
    lis[0] +=2
    cou += 1
    lis.sort()
if lis[0] == lis[1] and lis[1] == lis[2]:
    print(cou)
elif lis[1] == lis[2]:
    print((cou + 2))
else:
    print((cou + 1))

# Optimized solution
import math
lis = list(map(int,input().split()))
lis.sort()
ans = 0
while True:
    if lis[0] == lis[2]:
        print(ans)
        exit()
    if lis[0] == lis[1]:
        lis[0] += 1
        lis[1] += 1
    else:
        lis[0] += 2
    ans += 1
    lis.sort()
# Original solution
nums = sorted(list(map(int, input().split())))
ans = 0
while nums[0] != nums[-1]:
  if nums[-1] - nums[0] >= 2:
    nums[0] += 2
    nums = sorted(nums)
    ans += 1
  else:
    nums[0] += 1
    nums[1] += 1
    nums = sorted(nums)
    ans += 1
print(ans)

# Optimized solution
nums = sorted(list(map(int, input().split())))
ans = 0
while nums[0] != nums[-1]:
  if nums[-1] - nums[0] >= 2:
    nums[0] += 2
  else:
    nums[0] += 1
    nums[1] += 1
  nums = sorted(nums)
  ans += 1
print(ans)
# Original solution
import collections
a,b,c = list(map(int,input().split()))
lists = [str(a%2),str(b%2),str(c%2)]
abc = [a,b,c]
an = []
if len(set(lists)) != 1:

    d = collections.Counter(lists)
    jud = int(d.most_common()[0][0])
    for i in range(3):
        if jud == int(lists[i]):
            an.append(i)
    for i in an:
            abc[i] += 1
    cnt = 1
else:
    cnt = 0

while 1:
    Max = max(abc)
    count = 0
    for i in range(3):
        if Max == abc[i]:
            count += 1
    if count == 1:
        cnt += 1
        for i in range(3):
            if Max != abc[i]:
                abc[i] += 1

    elif count == 2:
        cnt += abs(max(abc) - min(abc)) // 2
        abc.sort()
        abc[0] += abs(max(abc) - min(abc))
    elif count == 3:
        break

print(cnt)


# Optimized solution
abc = list(map(int,input().split()))
guki = [abc[0] % 2,abc[1] % 2,abc[2] % 2]
cnt_gusu = 0
cnt = 0
for i in abc:
    if i % 2 == 0:
        cnt_gusu += 1
if cnt_gusu == 2:
    cnt += 1
    for i in range(3):
        if abc[i] % 2 == 0:
            abc[i] += 1
elif cnt_gusu == 1:
    cnt += 1
    for i in range(3):
        if abc[i] % 2 == 1:
            abc[i] += 1
set_abc = set(abc)
abc.sort()
if len(set_abc) == 1:
    print(cnt)
elif len(set_abc) == 2:
    maxv = max(abc)
    jud = 0
    for i in abc:
        if i == maxv:
            jud += 1
    if jud == 2:
        cnt += (abc[2] - abc[0]) // 2
    else:
        cnt += (abc[2] - abc[0])
    print(cnt)
else:
    zouka = abc[2] - abc[1]
    cnt += zouka + ((abc[2] - (abc[0]+zouka) ) // 2)
    print(cnt)