local a, b, s = io.read("*n", "*n", "*n") if(a <= 1) then a = 1 - a end if(b <= 1) then b = 1 - b end if(s <= 1) then s = 1 - s end if(s == 0) then print(a + 1) else print(math.min(math.abs(a - s), math.abs(b - s)) + s) end