main :: IO ()
main = do
    input <- getLine
    let [tables, first, second] = (map read $ words input) :: [Int]
    if even (second - first) 
        then 
            print $ (second - first) `div` 2
        else print $ calc 0 first second


calc :: Int -> Int -> Int -> Int
calc count first second
    | even (second - first)  = count + (second - first) `div` 2
    | first == 1 = calc (count + 1) first (second - 1)
    | otherwise = calc (count + 1) (first - 1) (second - 1)

