"use strict";

const main = arg => {
    const input = arg.trim().split("\n");

    let n = parseInt(input[0].split(" ")[0]);
    let a = parseInt(input[0].split(" ")[1]);
    let b = parseInt(input[0].split(" ")[2]);
    let r = a > b ? a:b
    let l = a < b ? a:b
    if(r-l % 2 ==0){
        console.log((r-l)/2)
    }else {
        if(n-r > l){
            console.log(r-1)
        }else{
            console.log(n-l)
        }
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

