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

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