#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #if __has_include() #include using namespace atcoder; #endif #define GET_MACRO(_1, _2, _3, NAME, ...) NAME #define _rep(i, n) _rep2(i, 0, n) #define _rep2(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() using i64 = long long; template bool chmin(T& a, const U& b) { return (b < a) ? (a = b, true) : false; } template bool chmax(T& a, const U& b) { return (b > a) ? (a = b, true) : false; } inline void YesNo(bool f, string yes = "Yes", string no = "No") { std::cout << (f ? yes : no) << "\n"; } template istream& operator>>(istream& i, vector& v) { rep(j, v.size()) i >> v[j]; return i; } template string join(vector& v) { stringstream s; rep(i, v.size()) s << ' ' << v[i]; return s.str().substr(1); } template ostream& operator<<(ostream& o, vector& v) { if (v.size()) o << join(v); return o; } template string join(vector>& vv) { string s = "\n"; rep(i, vv.size()) s += join(vv[i]) + "\n"; return s; } template ostream& operator<<(ostream& o, vector>& vv) { if (vv.size()) o << join(vv); return o; } template vector div(T x) { vector res; for (T i = 1; i * i <= x; i++) { if (x % i == 0) { res.push_back(i); if (i * i == x) break; res.push_back(x / i); } } sort(all(res)); return res; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); i64 n, k; cin >> n >> k; i64 m = n * (n + 1) / 2; auto d = div(m); for (i64 y : d) { auto x = m / y; if (x < y) break; i64 c = (x + y - 1); if (c & 1) continue; i64 b = c / 2; i64 a = x - b; if (a >= 0) { cout << 1 << endl; return 0; } } cout << 2 << endl; }