import java.io.PrintWriter import java.util.* import kotlin.math.* fun PrintWriter.solve() { val size = 100000 val isPrime = BooleanArray(size) { true } val primes = mutableListOf() for (p in 2 until size) { if (!isPrime[p]) continue primes.add(p) var n = p * 2 while (n < size) { isPrime[n] = false n += p } } val m = nextInt() if (m == 0) { println(1) println(1) return } val s = m.toString(2).padStart(30, '0') var ind = 30 val ans = mutableListOf() for (i in 29 downTo 0) { if (s[i] == '1') { repeat(30 - i) { ans.add(primes[i] * primes[ind]) ind++ } } } println(ans.size) println(ans.joinToString(" ")) } fun main() { Thread(null, { val writer = PrintWriter(System.out, false) writer.solve() writer.flush() }, "solve", abs(1L.shl(26))) .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } } .apply { start() }.join() } // region Scanner private var st = StringTokenizer("") private val br = System.`in`.bufferedReader() fun next(): String { while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) return st.nextToken() } fun nextInt() = next().toInt() fun nextLong() = next().toLong() fun nextLine() = br.readLine() fun nextDouble() = next().toDouble() // endregion