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