/**
 * @param input number[]
 */
function Main(input) {
  const n = input[0];
  const a = input[1];
  const b = input[2];

  var answer;
  const diff = Math.abs(a - b);
  if (diff % 2 === 0) {
    answer = diff / 2;
  } else {
    // 端との距離が近い方で調整
    var roundsForFix;
    if (a - 1 < n - b) {
      // aが卓1で勝利するまでの試合数
      roundsForFix = a;
      const bFixed = b - roundsForFix;
      // a = 1
      answer = roundsForFix + (bFixed - 1) / 2;
    } else {
      // bが卓Nで敗亡するまでの試合数
      roundsForFix = n - b + 1;
      const aFixed = a + roundsForFix;
      // b = n
      answer = roundsForFix + (n - aFixed) / 2;
    }
  }

  console.log(answer);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(" ").map(Number));