'use strict';
const main = input => {
  const num = input[0].split(' ').map(val => parseInt(val));
  let n = num[0], a = num[1], b = num[2];
  let dist = b-a;
  let l = b-1, r = n-a;
  const checkEven = value => {
    if (value%2) {
      return 0;
    } else {
      return 1;
    }
  }
  if (checkEven(dist)) {
    console.log(dist/2);
  } else {
    console.log(Math.min(l,r));
  }
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));