#include #include #include #include #include #include #include #include #include #include #define FORR(i, a, b) for(int (i) = (a); (i) < (b); (i)++) #define REP(i, n) FORR(i, 0, n) #define mp make_pair; using namespace std; int main() { int n, s, t; while (cin >> n >> s >> t) { if (s == t) { if (n == 1) cout << "0\n"; else cout << "-1\n"; } else if ((s == 1 && t == n) || (s == n && t == 1)) cout << "0\n"; else if (s == 1 || s == n) cout << "1\n"; else if (s + 1 == t || t + 1 == s) cout << "1\n"; else cout << "2\n"; } return 0; }