#include <bits/stdc++.h>
using namespace std;
int main(void) {
  unsigned long int N = 0, A = 0, B = 0, dist = 0;
  double sum = 0;
  cin >> N >> A >> B;
  dist = B - A;
  if (dist % 2 == 0) {
    cout << dist / 2 << endl;
  } else if ((B - 1) > (N - A)) {
    cout << N - A << endl;
  } else {
    cout << B - 1 << endl;
  }
  return 0;
}
