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

#define ll long long

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