local a = {}
a[1], a[2], a[3] = io.read("*n", "*n", "*n")
local min = math.min(math.min(a[1], a[2]), a[3])
local max = math.max(math.max(a[1], a[2]), a[3])
local mincnt = -1
for tgt = min, max do
  local cnt = 0
  for i = 1, 3 do
    if(a[i] < tgt) then
      if((tgt - a[i]) % 2 == 0) then
        cnt = cnt + (tgt - a[i]) // 2
      else
        cnt = cnt + (tgt - a[i]) // 2 + 2
      end
    elseif(tgt < a[i]) then
      cnt = cnt + a[i] - tgt
    end
  end
  if(tgt == min) then mincnt = cnt else mincnt = math.min(mincnt, cnt) end
end
print(mincnt)
