You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order:    * Choose two among A, B and C, then increase both by 1.   * Choose one among A, B and C, then increase it by 2.  It can be proved that we can always make A, B and C all equal by repeatedly performing these operations.
a,b,c=map(int,input().split())
lst=[a,b,c]
lst.sort()
mid=lst[2]
dif1=lst[2]-lst[1]
dif2=lst[1]-lst[0]
q1,mod1=divmod(dif1,2)
q2,mod2=divmod(dif2,2)
dif3=min(dif1,dif2)
if mod1==mod2:
  if mod1==0:
    print(dif1+dif2)
  else:
    print(dif1+dif2+1)
else:
  print(dif1+dif2+2)
  


a,b,c=map(int,input().split())
lst=[a,b,c]
lst.sort()
dif1=lst[2]-lst[1]
dif2=lst[2]-lst[0]
q1,mod1=divmod(dif1,2)
q2,mod2=divmod(dif2,2)
dif3=min(dif1,dif2)
if mod1==mod2:
  if mod1==0:
    print(q1+q2)
  else:
    print(q1+q2+1)
else:
  print(q1+q2+2)
  

