#include <bits/stdc++.h>
#include<vector>
using namespace std;
 
int main() {
 long int a,b,c,d;
  cin>>a>>b>>c;
  d=min(max(b,c)-1,a-(max(b,c))+1);
  if((b-c)%2==0)cout<<(max(b,c)-min(b,c))/2;
  else cout<<min(b-1,a-c)+(c-b+1)/2;
}