#include #include #include using namespace std; struct prime_sturcture { int max_n; std::vector p; std::vector prime_list; prime_sturcture(int max_n) : max_n(max_n), p(max_n + 1, true) { p[0] = p[1] = false; for (int i = 2; i <= max_n; i++) { if (p[i]) { prime_list.push_back(i); for (int j = i * 2; j <= max_n; j += i) { p[j] = false; } } } } bool is_prime(int n) { assert(n <= max_n); return p[n]; } int size() { return prime_list.size(); } const int operator[](int i) const { assert(i < (int)prime_list.size()); return prime_list[i]; } std::vector::const_iterator begin() { return prime_list.begin(); } std::vector::const_iterator end() { return prime_list.end(); } }; int main() { int m; cin >> m; if(!m) { m += 998244353; } prime_sturcture prime(50000); int l = 0, r = prime.size() - 1; vector ans; while (m) { for (int i = 30; i >= 0; i--) { if (m >= (1 << i) - 1) { while (prime[l] * prime[r] > 100000) { r--; } for (int j = 0; j < i; j++) { ans.push_back(prime[l] * prime[r--]); } m -= (1 << i) - 1; l++; break; } } } cout << ans.size() << endl; for (int a : ans) { cout << a << " "; } cout << endl; }