// ABEY SAALE
// QUESTION KHUD KR SOLUTION KYU DEKH RHA H
 
 

//MAAF KIJIYEGA ME GUSSE ME IDHAR UDHAR NIKAL JATA HU

// Author : Ritik Patel
// Institution: Pandit Deendayal Petroleum University
 
#include <bits/stdc++.h>
using namespace std;
 
#define sz(a) int((a).size())
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 
#define what_is(x) cout << #x << " is: " << x << endl;
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
 
#define bitcount(a) __builtin_popcount(a)   // count set bits
#define lzcount(x) __builtin_clz(x)        // count leading zeros in binary representation of number
#define tzcount(x) __builtin_ctz(x)        // count trailing zeros in binary representation of number
 
#define FAST ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
 
typedef long long ll;
typedef long double lld;
const ll MOD = 998244353;
const lld PI = acos(-1.0);
 
template<typename T> T gcd(T a,T b){ if(b>a) return gcd(b,a);return b==0?a:gcd(b,a%b); }
template<typename T> T lcm(T a, T b) { return a * b / gcd(a, b); }
template<typename T> T fast_power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
template<typename X> inline X abs(const X& a) { return a < 0? -a: a; }
template<typename X> inline X sqr(const X& a) { return a * a; }
template<typename T> inline string toStr(T x) { stringstream st; st << x; string s; st >> s; return s; }
 
bool isprime(ll a){ if(a==2) {return 1;}if(!(a&1) ) {return 0;}for(ll i=3;i*i<=a;i+=2){if(a%i==0) {return 0;} } return 1;} 
//Fermat little theorem -> a^(M-1) % M = 1; iF M is prime   
// Multilply both sides by a^-1 ==> a^(M-2)%M = a^-1 
template<typename T>//(a/b)%MD IFF MD -> PRIME
T modDiv(T a,T b,T MD){   return a*fast_power(b,MD-2,MD) % MD; }
template<typename T>
T extgcd(T a, T b, T &x, T &y) {  //when a and b are coprimes(or gcd(a,b)==1) in ax+by = t*gcd(a,b);
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  T p = b / a;
  T g = extgcd(b - p * a, a, y, x);
  x -= p * y;
  return g;
}
ll inv(ll a, ll m) { ll x, y;  extgcd(a, m, x, y);  return (x + m) % m; } //IFF GCD(a,m) = 1;

template<typename T>
T largestPower(T n,T p){        // Returns largest power of p that divides n!
    T total = 0;
    while (n){                  // Calculate x = n/p + n/(p^2) + n/(p^3) + ...
        n /= p;
        total += n;
    }
    return total;
}

int doublecomp(double a, double b){
    if( (a-b) <= 0.0000000001 ) return 1; // a <= b;
    else  return 0;
}

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll; 
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};

template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }


const int INF = 1<<30;
const ll LINF = 1ll<<60;
 
/*-> For counting number of digits, directly do floor(log10(n)+1)
  -> Whenever comparing fractions, it is better to cross-multiply so we can avoid the use of doubles
  ->
*/
               /* -------------------------------Main Code------------------------------- */  

///CHECK ll vs INT( costed me 5 to 6  wrong submissions in easy sum)


int main(){
	FAST
	ll n, a , b;
	cin >> n >> a >> b;
	ll ans = 0LL;
	if ( (b - a) % 2LL == 0LL ){
		ans = (b - a)/2LL;
	} else {
		//ans =  min( b - 1LL, n - a);
		ans = min( a + (b - a)/2LL, n - b + 1LL + (b - a)/2LL ); //min of left or right
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256