#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long n,a,b;
int main()
{
	scanf("%lld %lld %lld",&n,&a,&b);
	if((a-b)&1)printf("%lld",min((n-a+n-b+1)/2,(a+b-1)/2));
	else printf("%lld",abs(a-b)/2);
	return 0;
}
