function Main(input) {
	var str = input;
	var ans = 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]);
	
	var sa = a-1;
	var sb = b-1
	var bn = n - b;
	var an = n - a;
	var ab = b - a;
	if (ab%2 !==0){//奇数
		if(sa<=bn){//saの方が小さい
			ans = sb;
		}else{
			ans = an;
			}
	}else{
		ab = ab/2;
		if (ab<=sa&& ab<=bn){
			ans = ab;
		if(sa<=bn){//saの方が小さい
			ans = sb;
		}else{
			ans = an;
			}
		}
	}
	console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));