import std.algorithm, std.array, std.conv, std.range, std.stdio, std.string;
void main()
{
    auto buf = readln.chomp.split.to!(long[]);
    solve(buf[0], buf[1], buf[2]).writeln;
}
long solve(in long n, in long a, in long b)
{
    if ((b - a) & 1)
        return min(a, n - b + 1) + (b - a) / 2;
    return (b - a) / 2;
}
