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(" ");
    if(Math.abs(A-B)%2===0){
        console.log(Math.abs(A-B)/2);
    }else{
        console.log(Math.min(Math.max(A-1, B-1), Math.max(N-A, N-B)))
    }
});
