#include <bits/stdc++.h>
using namespace std;

long long n, a, b;

int main() {
  scanf("%lld %lld %lld", &n, &a, &b);
  if (b - a & 1) {
    printf("%lld\n", min(a-1, n-b) + ((b-a+1) >> 1));
  } else printf("%lld\n", b-a >> 1);
  return 0;
}
