/**
 * @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 = Math.ceil(diff / 2);
  } else {
    // 1かnのテーブル
    answer = Math.min(Math.max(a, b) - 1, n - Math.min(a, b));
  }

  console.log(answer);
}

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