const input = process.argv.slice(2);
input[0] = parseInt(input[0]);
input[1] = parseInt(input[1]);
input[2] = parseInt(input[2]);

const tableTennis = ([N, A, B]) => {
    // Even amount of tables in between
  if ((B - A) % 2 == 0) {
    return ((B - A) / 2);
  }
  
  // Uneven amount of tables in between
  if (A - 1 < N - B) {
    return A + (B - A - 1) / 2;
  } else {
    return N - B + 1 + (N - A + N - B + 1) / 2
  }
}

console.log(tableTennis(input))