program ABC_093_C_SameIntegers
   implicit none
   integer am, m, i,countN, a(1: 3)
   read(*, *) a(1: 3)
   do i = 1, 2
      am = maxval(a(i+1:3))
	  m  = maxloc(a(i+1:3), 1) + i
	  if (a(i) < am) then
	      a(m) = a(i)
		  a(i) = am
	  end if
   end do
   countN = 0
   if(a(1) == a(2)) then
       if(mod(a(1)-a(3),2) == 0) then
           countN = (a(1) - a(3)) / 2
           write(*, *) countN
	   else
           countN = (a(1) - a(3)) / 2 + 1 + 1
           write(*, *) countN
	   end if
   else
       if(mod(a(1)-a(3),2) == 0) then
           countN = (a(1) - a(3)) / 2
	       a(3) = a(3) + 2 * (a(1) - a(3)) / 2
       else
           countN = (a(1) - a(3)) / 2 + 1
	       a(3) = a(3) + 2 * (a(1) - a(3)) / 2 + 1
	       a(2) = a(2) + 1
       end if
       if(a(1) == a(2)) then
           write(*, *) countN
       else if(mod(a(1)-a(2),2) == 0) then
           countN = countN + (a(1) - a(2)) / 2
	       write(*, *) countN
       else
           countN = countN + (a(1) - a(2)) / 2 + 1 + 1
	       write(*, *) countN
       end if 
   end if
end program ABC_093_C_SameIntegers