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

int main(){
  int64_t n,a,b;
  cin >> n >> a >> b;
  if((a-b)%2==0){
    cout << abs(a-b)/2 << endl;
  }else{
      cout << min((a+b-1)/2,(n-a+n-b+1)/2) << endl;
  }
  return 0;
}