#include<iostream>
#include<algorithm>
using namespace std;
long N,A,B;
int main()
{
	cin>>N>>A>>B;
	if(A%2==B%2)
	{
		long d=abs(A-B);
		cout<<d/2<<endl;
	}
	else
	{
		cout<<min(A,N-B+1)+(B-A-1)/2<<endl;
	}
}
