function Main(input) {
  const array = input.trim().split(' ').map(s => parseInt(s))
  const N = array[0]
  const A = array[1]
  const B = array[2]

  if( A === B) console.log(0)

  const dist = B - A
  if(dist % 2) {
    // 奇数処理
    var left = Math.abs(1 - A)
    var right = Math.abs(N - B)
    var ans = 0
    if (left < right) {
      ans = Math.abs(1 - B)
    } else {
      ans = Math.abs(N - A)
    }

    console.log(ans)

  } else {
    // 偶数処理
    console.log(dist/2)
  }

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));