#include <bits/stdc++.h>
using namespace std;
int main()
{
  int64_t N,A,B;
  cin>>N>>A>>B;
  if((A+B)%2==0){cout<<(B-A)/2<<endl;}
  else{if(N-A<B-1){cout<<(2*N-A-B+1)/2<<endl;}else{cout<<(A+B-1)/2<<endl;}}
}