import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

long solve (in long n, in long a, in long b) {
  long r1, r2;
  long x = a, y = b;
  r1 += a - 1;
  x -= a - 1;
  y -= a - 1;
  r1++;
  y--;
  r1 += (y - 1) / 2;

  x = a; y = b;
  r2 += (n - b);
  y = n;
  x += (n - b);
  r2++;
  x++;
  r2 += (n - x) / 2;
  return min (r1, r2);
}

long test () {
  long n, a, b;
  readf (" %d %d %d", &n, &a, &b);
  if (a == b) return 0;
  long d = abs (a - b);
  if ((d % 2) == 0) return d / 2;
  if (a > b) swap (a, b);
  return solve (n, a, b);
  /*
  long r1 = max (a, b) - 1;
  long r2 = n - min (a, b);
  return min (r1, r2);
  */
}

void main() {
  writeln (test ());
}

