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

long long n, a, b;

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