//JSD
#include<iostream>
#define ll long long 
using namespace std;
int main(){	
	ll n,a,b;
	cin>>n>>a>>b;
	if((b-a)%2==0){
		cout<<(b-a)/2<<"\n";
	}
	else{
		if(a>b)
			swap(a,b);	
		ll p=a,q=b;
		ll r=(b-a+1)/2+(a-1);
		ll s=(b-a+1)/2+(n-b);
		ll ans=min(r,s);
		cout<<ans<<"\n";
	}	
	return 0;
}