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

  var count = 0
  var ans = 0
  while(true) {
    var dist = B - A
    if (dist % 2) {
      var left = Math.abs(1 - A)
      var right = Math.abs(N - B)

      if ( left < right) {
        B -= 1
        if(A !== 1) A -= 1
      } else {
        if(B !== N) B += 1
        A += 1
      }
    } else {
      ans = count + dist / 2
      break
    }
    count++
  }
  console.log(ans)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));