console.log((args=>{
  const [N,A,B] = args.trim().split` `.map(v=>parseInt(v));
  if ( (B-A) % 2 === 0 ) return `${(B-A)/2}`;
  return `${Math.min(N-B,A-1)+(B-A+1)/2}`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
