"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 cnt = 0
    let r = a > b ? a:b
    let l = a < b ? a:b
    if((r-l) % 2 ==0){
        while(r !== l){
            r--
            l++
            n--
            cnt++
        }
    }else {
        if(n-r > l){
            while(r !== l){
                if(l!==1) l--
                r--
                cnt++
                n--
            }
        }else{
            while(r !== l){
                if(r!==n) r++
                l++
                cnt++
                n--
            }
        }
    }
    console.log(cnt)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

