#include <bits/stdc++.h>
using namespace std;
#define fast()  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl "\n"
#define mod 1000000007
#define PI 3.14159265358979323846
#define f first
#define s second
#define un unordered
#define for0(i,n) for(i=0;i<n;i++)
#define for1(j,n) for(j=1;j<=n;j++)
#define ll long long int
vector<ll> primes;
bool specialPrimeNumbers(ll n, ll k) 
{ 

	for (ll i = 0; i < primes.size(); i++) {
		for (ll j = 0; j < i; j++) { 
			
			if (primes[i] + primes[j]== n) { 
				return true;
			} 
		} 
	} 
	return false; 
} 

bool cmp(pair<double,int>  p,pair<double,int> p1){
	return p.first<p1.first;
}


ll power(ll x,ll y,ll p) 
{ 
    ll res = 1;      // Initialize result 

    x = x % p;  // Update x if it is more than or  
                // equal to p 

    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
    	if (y & 1) 
    		res = (res*x) % p; 

        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;   
    } 
    return res; 
} 
class edge{
	public :
	int a,b;
};
struct subset 
{ 
	int parent; 
	int rank; 
}; 

int find(struct subset subsets[], int i) 
{ 
    // find root and make root as parent of i (path compression) 
	if (subsets[i].parent != i) 
		subsets[i].parent = find(subsets, subsets[i].parent); 

	return subsets[i].parent; 
} 

void Union(struct subset subsets[], int x, int y) 
{ 
	int xroot = find(subsets, x); 
	int yroot = find(subsets, y); 

	if (subsets[xroot].rank < subsets[yroot].rank) 
		subsets[xroot].parent = yroot; 
	else if (subsets[xroot].rank > subsets[yroot].rank) 
		subsets[yroot].parent = xroot; 

	else
	{ 
		subsets[yroot].parent = xroot; 
		subsets[xroot].rank++; 
	} 
} 
void dfs(vector<int> edges[],int a,int b,int visit[],map<int,vector<int>> &mp){
	visit[a]=1;
	for(auto i : edges[a]){
		
		if(visit[i]==1){
			continue;
		}
		else{
			mp[b].push_back(i);

			dfs(edges,i,b+1,visit,mp);
		}
	}
}
string result(string s){
	
	return s;
}
void simpleSieve(int limit) 
{ 
    bool mark[limit+1]; 
	memset(mark, true, sizeof(mark)); 

	for (int p=2; p*p<limit; p++) 
	{ 
        // If p is not changed, then it is a prime 
		if (mark[p] == true) 
		{ 
            // Update all multiples of p 
			for (int i=p*2; i<limit; i+=p) 
				mark[i] = false; 
		} 
	} 

    for (int p=2; p<limit; p++) 
	{ 
		if (mark[p] == true) 
		{ 
			primes.push_back(p); 
       //     cout << p << " "; 
		} 
	} 
} 

void segmentedSieve(int n) 
{ 
	int limit = floor(sqrt(n))+1; 
	simpleSieve(limit);  

	int low = limit; 
	int high = 2*limit; 

	while (low < n) 
	{ 
		if (high >= n)  
			high = n; 

		bool mark[limit+1]; 
		memset(mark, true, sizeof(mark)); 

		for (int i = 0; i < primes.size(); i++) 
		{ 
			int loLim = floor(low/primes[i]) * primes[i]; 
			if (loLim < low) 
				loLim += primes[i]; 

            for (int j=loLim; j<high; j+=primes[i]) 
				mark[j-low] = false; 
		} 

        for (int i = low; i<high; i++) 
			if (mark[i - low] == true) 
				primes.push_back(i);

        	low = low + limit; 
			high = high + limit; 
	} 
} 
int dfs(vector<ll> edges[],ll &u,ll v){
	
	for(auto i:edges[u]){
		if(i!=v){
			u=i;
			return 1;
		}
	}
	return 0;
}

int dfs1(vector<ll> edges[],ll &u,ll v,map<int,int> &mp){

	for(auto i:edges[u]){
		if(i==v){
			u=i;
			return 1;
		}
		else{
			if(mp.count(i)>0)
				continue;
			u=i;
			mp.insert({i,1});
		}
	}

	return 0;
}
void solve(){
	
	ll n;
	cin>>n;
	ll a,b;
	cin>>a>>b;
	if(abs(a-b)%2==0){
		cout<<abs(a-b)/2<<endl;
	}
	else{
		cout<<min(max((ll)0,n-(a+b-1)/2),max((ll)0,(a+b-1)/2))<<endl;
	}
}
int main(){

	fast()
	     
	int t=1;
	for(int i=0;i<t;i++)
		solve();	
	return 0;
}
	

Measured memory_bytes: 256