program answer
  implicit none

  integer :: A1, A2, A3, i, cost1, cost2, cost3

  read(*,*) A1, A2, A3

  if(A3<A2) then
     cost1=abs(A3-A1)+abs(A2-A3)
  else
     cost1=abs(A2-A1)+abs(A2-A3)
  end if

  if(A1<A3) then
     cost2=abs(A1-A2)+abs(A1-A3)
  else
     cost2=abs(A3-A2)+abs(A3-A1)
  end if

  if(A1<A2) then
     cost3=abs(A1-A3)+abs(A1-A2)
  else
     cost3=abs(A2-A3)+abs(A2-A1)
  end if

  write(*,*) min(cost1,cost2,cost3)

  stop
 end program answer