#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

void solve() {
  ll N, A, B;
  cin >> N >> A >> B;
  if ((B-A) % 2 == 0) {
    cout << (B-A) / 2 << endl;
    return;
  } else {
    ll aaa = min(A-1, N-B);
    ll ans = aaa + 1 + (B-A) / 2;
    cout << ans << endl;
    return;
  }
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}
