#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3") 
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <chrono> 
using namespace __gnu_pbds;
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;
using namespace std::chrono; 
/* 
auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now(); 
auto duration = duration_cast<microseconds>(stop - start); 
cout << "Time taken by function: "<< duration.count() << " microseconds" << endl; 
*/




typedef long l;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
typedef vector<vector<int> > vvi;
typedef vector<vector<long> > vvl;
typedef vector<vector<long long > > vvll;
typedef pair<int,int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef vector< pi > vpi;
typedef vector< pl > vpl;
typedef vector< pll > vpll;
typedef vector<vector<pi> > vvpi;
typedef vector<vector<pll> > vvpll;
typedef vector<vector<pl> > vvpl;
typedef priority_queue<int> maxheapi;
typedef priority_queue<int , vector<int> , greater<int> > minheapi;
typedef priority_queue<pi> maxheappi;
typedef priority_queue<pi , vector<pi> , greater<pi> > minheappi;
typedef map<int,int> mpi;
typedef unordered_map<int,int> umpi;
typedef set<int> si;
typedef multiset<int> msi;

#define setbits(x) __builtin_popcount(x)
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb emplace_back
#define ppb pop_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define flush fflush(stdout)
#define fill(a,x) memset(a,x,sizeof(a))
#define fi first
#define se second
#define trav(a, x) for(auto& a : x) 
#define F(i,a,b) for(int i = a; i<=b; ++i)
#define NF(i,a,b) for(int i = a; i>=b; --i)
#define endl '\n'
#define swap(a,b)	{auto _x=a;a=b;b=_x;}
#define in insert
#define er erase
#define fout(x) fixed<<setprecision(x)
#define ran(a, b) ((((rand() << 15) ^ rand()) % ((b) - (a) + 1)) + (a))
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

const ll inf = 1e18;
const int mod = 1e9 + 7;
const double PI = acos(-1);
//const int dx[]={1,0,-1,0,1,-1,-1,1};
//const int dy[]={0,1,0,-1,1,1,-1,-1};
//const int fr[4] = {-1,1,0,0};
//const int fc[4] = {0,0,1,-1};

//note less_equal works as multiset but cannot use delete items here
//best to use only less instead of less_equal
typedef tree<int , null_type, less_equal<int>, 
rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//*X.find_by_order(2) element at index=2 
//find_by_order takes a "number" i and returns value at index i
//X.order_of_key(1) how many elements strictly less than 1(even in case of less_equal)

//to use as a multiset use set with pairs
//Main idea is to keep pairs like { elem , id } .

typedef tree<
pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
/*
int t = 0;
ordered_set me;
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";
cout << me.find_by_order(1)->first ;
*/
////////////////////////////////////////////////////////////////////////////////////////////////
//debugger
#define tr1(x)                cerr << #x << ": " << x << endl;
#define tr2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define tr3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define tr4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define tr5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define tr6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
//uncomment below line before submitting final code to remove all cerr lines at once
#define cerr if(false)cerr
////////////////////////////////////////////////////////////////////////////////////////////////


ll gcd(ll a,ll b){if (a==0) return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return a*(b/gcd(a,b));}
l Abs(l a){if(a>0)return a;return -a;}
ll Ceil(ll a,ll b){if(a%b==0)return a/b;else return a/b+1;}
double Abs(double a){if(a>0)return a;return -a;}

inline int pow_(ll x, ll y,ll p)//(x^y)%p
{
int r=1; while(y){if(y&1) r=r*x%p; y >>= 1; x=x*x%p;} return r;
}
inline int inv_(int x){return pow_(x, mod - 2, mod);}//x inverse %mod
inline int add(ll a,ll b){a += b; if(a >= mod) a -= mod; return a;}
inline int mul(int a, int b){return a * 1LL * b % mod;}
inline int sub(int a, int b){a -= b; if(a < 0) a += mod; return a;}


template <typename T>
inline void showvec(vector<T> v){int s = v.size(); for(int i = 0 ; i<s ; i++)cout<<v[i]<<" ";cout<<endl; }
template <typename T>
inline void show2dvec(vector<vector<T> > v)
{int s = v.size(); for(int i = 0 ; i<s ; i++){int s2 = v[i].size(); for(int  j = 0 ; j<s2 ; j++) cout<<v[i][j]<<" "; cout<<endl;}}

int main()
{
    fio;
    int t= 1;
    //cin>>t;
    while(t--)
    {
        l n,a,b;
        cin>>n>>a>>b;
        l d = b-a;
        //d = (l)Abs(d);
        if(d%2==0)
        cout<<d/2<<endl;
        else
        {
            l a1 = b-1;
            l a2 = (n-a);
            a1 = min(a1,a2);
            l b1 = a+(b-a-1)/2;
            l b2 = (n-b+1)+(b-a-1)/2;
            b1 = min(b1,b2);
            cout<<min(a1,b1)<<endl;
        }
        
        
        
        
    }
    return 0;
}


Measured memory_bytes: 256