function Main(input) {
    input = input.trim();
    input = input.split(" ");
    var a = input[0];
    var b = input[1];
    var c = input[2];

    var result = 0;

    

    if((c-b)%2==0){  
        result = (c-b)/2;
        if((b+c-2)>=0){
            result = Math.min(result,(b+c-2)/2);
        }
        if((2*a-b-c)>=0){
            result = Math.min(result,(2*a-b-c)/2);
        }
    }else{
        var d = a - b;
        var e = c - 1;
        result = Math.min(d,e);
        if((c-b-1)>=0){
            var f = d-(c-b-1)/2;
            var g = e-(c-b-1)/2;
            result =Math.min(result,Math.min(f,g));
        }
        
    }
    



    console.log(result);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8")); 