#include<iostream>
using namespace std; 

int main()
{
  int64_t N,A,B ;
  cin>>N>>A>>B ;
  
  if((B-A)%2==0) cout<<(B-A)/2<<endl ;
  else{
    if(A<=N-B) cout<<A+(B-A-1)/2<<endl ;
    else cout<<N-B+1+(B-A-1)/2<<endl ;
  }
  
  return 0 ;
}
