function Main(input) {
	var str = input;
  	var ans = 0;
	var ans1 = 0;
	var ans2 = 0;
	var str = str.split("\n")[0];
	var num = str.split(" ");
	var n = Number(num[0]);	
	var a = Number(num[1]);	
	var b = Number(num[2]);
	
		if ((b-a)%2 !==0){//奇数ずれてる
			ans1 = (2*n+1-a-b)/2;
			ans2 = (a+b-1)/2;
          	if(ans1<=ans2){//短い方
            	ans = ans1;
            }else{
            	ans = ans2;
            }
		}else{
			ans = (b-a)/2;
		}
	console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
