function TT(a,b,N){
  var r = a+(b-a-1)/2
  a = N-a+1
  b = N-b+1
  var l = a+(b-a-1)/2 
  return Math.min(r,l);
}
function Main(input) {
  input = input.split(" ").map(Number);
  var N = input[0];
  var A = input[1];
  var B = input[2];
  if(A%2==B%2){
    console.log(Math.abs(A-B)/2);
  }else{
    if(A<B){
      console.log(TT(A,B,N));
    }else{
      console.log(TT(B,A,N))
    }
  }
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));