A=io.read("n")
B=io.read("n")
C=io.read("n")
if A>B then
  A,B=B,A
end
if B>C then
  B,C=C,B
  if A>B then
    A,B=B,A
  end
end
local count=0
if (B-A)%2==0 then
  count=(B-A)//2+C-B
  else count=(B+1-A)//2+C-B+1
end
print(count)