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

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