#include using namespace std; int main() { int n, s, t; while (cin >> n >> s >> t) { int r = s - t; if (r == 0) { if (n == 1) cout << 0 << endl; else cout << -1 << endl; continue; } if (r == 1 || r == -1) { if (n == 2) cout << 0 << endl; else cout << 1 << endl; continue; } if (r < 0) { if (s == 1) { if (t == n) cout << 0 << endl; else cout << 1 << endl; continue; } else { cout << 2 << endl; continue; } } else { if (s == n) { if (t == 1) cout << 0 << endl; else cout << 1 << endl; } else { cout << 2 << endl; continue; } } } }