n,a,b = gets.chomp.split(' ').map(&:to_i)

dist = b - a
round = 0

for i in 1..n do
    if dist % 2 == 0 then
        puts dist /  2 + round
        exit 0
    else
        nDis = n - b
        oDis = a - 1
        if nDis < oDis then
            a += 1
            if b != n then
                b += 1
            end
        else
            b += 1
            if a != n then
                a += 1
            end
        end
        round += 1
    end
end