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 
  console.log(Math.min(r,l));
}
function Main(input) {
  input.trim();
  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){
      TT(A,B,N);
    }else{
      TT(B,A,N);
    }
  }
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));