const Main = function(input){
    input = input.split(" ")
    input = input.map((s)=>parseInt(s))
    console.log(input)

    let result = 0
    let p1 = 0
    let p2 = 0

    if(input[1]<input[2]){
        p1 = input[1]
        p2 = input[2]
    }else if(input[2]<input[1]){
        p1 = input[2]
        p2 = input[1]
    }

    while((p2-p1)%2!==0){
        let tmp1 = p1 - 1
        let tmp2 = input[0] -p2
        if(tmp1>tmp2){
            p1++
            p2++
            if(p2>=input){p1++;result+=2;break;}
        }else{
            p1--
            p2--
            if(p1<=1){p2--;result+=2;break;}
        }
        result++
    }

    while(p1!==p2){
        p1 += 1
        p2 -= 1
        result++
    }
  
  return result
}

console.log(require("fs").readFileSync("/dev/stdin", "utf8"))
