process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
    const [N, A, B] = lines[0].split(" ").map(v=>BigInt(v));
    if((A-B>0?(A-B):(B-A))%2n===0){
        console.log(((A-B>0?(A-B):(B-A))/2n).toString());
    }else{
        console.log(min(max(A-1n, B-1n), max(N-A, N-B)).toString())
    }
});
min = (a,b)=>{return a<b?a:b};
max = (a,b)=>{return a>b?a:b};

