Vasya and Petya are playing a simple game. Vasya thought of number x between 1 and n, and Petya tries to guess the number.

Petya can ask questions like: "Is the unknown number divisible by number y?".

The game is played by the following rules: first Petya asks all the questions that interest him (also, he can ask no questions), and then Vasya responds to each question with a 'yes' or a 'no'. After receiving all the answers Petya should determine the number that Vasya thought of.

Unfortunately, Petya is not familiar with the number theory. Help him find the minimum number of questions he should ask to make a guaranteed guess of Vasya's number, and the numbers y_{i}, he should ask the questions about.


-----Input-----

A single line contains number n (1 ≤ n ≤ 10^3).


-----Output-----

Print the length of the sequence of questions k (0 ≤ k ≤ n), followed by k numbers — the questions y_{i} (1 ≤ y_{i} ≤ n).

If there are several correct sequences of questions of the minimum length, you are allowed to print any of them.


-----Examples-----
Input
4

Output
3
2 4 3 

Input
6

Output
4
2 4 3 5 



-----Note-----

The sequence from the answer to the first sample test is actually correct.

If the unknown number is not divisible by one of the sequence numbers, it is equal to 1.

If the unknown number is divisible by 4, it is 4.

If the unknown number is divisible by 3, then the unknown number is 3.

Otherwise, it is equal to 2. Therefore, the sequence of questions allows you to guess the unknown number. It can be shown that there is no correct sequence of questions of length 2 or shorter.

Source: codeforces | Difficulty: MEDIUM
Tags: Number theory

Mathematics


Solutions:
n = int(input())
a = [i for i in range(2, n + 1)]

def calculaDivisiores(num):
	atual = 2
	divs = []
	while atual <= num // 2 + 1:
		if num % atual == 0:
			divs.append(atual)
		atual += 1
		divs.sort(reverse=True)
	return divs
res = []
for num in a:
	divs = calculaDivisiores(num)
	if len(divs) == 1:
		res.append(num)
	else:
		res.append(num)
		for i1 in range(len(divs)):
			div1 = divs[i1]
			for i2 in range(i1, len(divs)):
				div2 = divs[i2]
				if div1 != div2:
					if div1 % div2 != 0:
						if num in res:
							res.remove(num)
print(len(res))
for r in res:
	print(r, end=' ')


n = int(input())
MAX_N = 1000.0 + 50
prime = [True] * int(MAX_N)

def sieve():
	i = 2
	while i * i < MAX_N:
		if prime[i] == True:
			j = 2
			while i * j < MAX_N:
				prime[i * j] = False
				j += 1
		i += 1
	prime[0] = False
	prime[1] = False
sieve()
ans = [False] * (n + 1)
for i in range(1, n + 1):
	if prime[i]:
		j = 1
		while i ** j <= n:
			ans[i ** j] = True
			j += 1
print(ans.count(True))
print(*[i for (i, value) in enumerate(ans) if value == True])


def get_primes(n):
	numbers = set(range(n, 1, -1))
	primes = []
	while numbers:
		p = numbers.pop()
		primes.append(p)
		numbers.difference_update(set(range(p * 2, n + 1, p)))
	return primes
n = int(input())
l = get_primes(n + 1)
ans = []
for x in l:
	p = x
	while p <= n:
		ans.append(p)
		p *= x
print(len(ans))
for x in ans:
	print(x, end=' ')


import copy
n = int(input())
l = list()
a = list()

def findprime(N):
	i = 2
	count = 0
	while i * i <= N:
		if i * i == N:
			count = count + 1
		elif N % i == 0:
			count = count + 2
		i = i + 1
	if count == 0 and N != 1:
		l.append(N)
for j in range(2, n + 1):
	findprime(j)
a = copy.copy(l)
for i in l:
	k = 2
	while i ** k <= n:
		a.append(i ** k)
		k = k + 1
print(len(a))
print(*a)


def sieve(n):
	prime = [True for i in range(n + 1)]
	prime[0] = False
	prime[1] = False
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def factor(n, p):
	i = 2
	f = {}
	while i < len(p) and n > 1:
		while n > 1 and n % i == 0 and (p[i] == True):
			if i in f:
				f[i] += 1
			else:
				f[i] = 1
			n //= i
		i += 1
	return f
n = int(input())
s = sieve(n)
visited = {}
q = []
c = 0
for i in range(2, n + 1):
	f = factor(i, s)
	question = True
	for k in f:
		if visited.get(k ** f[k], False):
			question = False
			break
	if question:
		c += 1
		q.append(str(i))
	visited[i] = True
print(c)
print(' '.join(q))


P = print
R = range
n = int(input())
x = ' '.join([' '.join((str(j ** i) for i in R(1, 11) if j ** i <= n)) for j in R(2, n + 1) if 0 == sum((j % i == 0 for i in R(2, j)))])
P(len(x.split()))
P(x)


n = int(input())
tester = [True] * (n + 1)
primes = []
ans = []
for i in range(2, n + 1):
	if tester[i]:
		primes.append(i)
		for j in range(i + i, n + 1, i):
			tester[j] = False
for k in primes:
	e = 2
	while k ** e <= n:
		ans.append(k ** e)
		e += 1
ans.extend(primes)
print(len(ans))
for o in ans:
	print(o, end=' ')


n = int(input())
divs = []
primes = []
p = 2
while p <= n:
	isP = True
	for p2 in primes:
		if p2 * p2 > p:
			break
		if p % p2 == 0:
			isP = False
			break
	if not isP:
		p += 1
		continue
	primes.append(p)
	ma = p
	while ma <= n:
		divs.append(ma)
		ma *= p
	p += 1
print(len(divs))
print(*divs)


n = int(input())
arr = [i for i in range(n + 1)]
flags = [0 for i in range(n + 1)]
primes = []
for i in range(2, n + 1):
	if flags[i]:
		continue
	primes.append(i)
	for j in range(i * 2, n + 1, i):
		flags[j] = 1
ans = set()
for number in primes:
	k = 1
	while number ** k <= n:
		ans.add(number ** k)
		k += 1
print(len(ans))
print(*ans)


prime = [2, 3, 5, 7, 11]

def create_list(n):
	global prime
	for x in range(prime[-1] + 2, n + 1, 2):
		notPrime = False
		hold = int(x ** 0.5) + 1
		for j in prime:
			if j > hold:
				break
			if x % j == 0:
				notPrime = True
				break
		if notPrime == False:
			prime.append(x)

def factors(n, inc):
	z = 2
	while z * z <= n:
		if n % z == 0:
			hold = n
			while n % z == 0:
				n //= z
			if hold // n not in inc:
				inc.append(hold // n)
		z += 1
	if n > 1 and n not in inc:
		inc.append(n)
	return inc

def main():
	mode = 'filee'
	if mode == 'file':
		f = open('test.txt', 'r')
	get = lambda : [int(x) for x in (f.readline() if mode == 'file' else input()).split()]
	[n] = get()
	create_list(n)
	if n == 1:
		print('0')
		return
	if n == 2:
		print('1\n2')
		return
	inc = []
	for i in range(2, n + 1):
		if i in inc:
			continue
		if i in prime:
			inc.append(i)
			continue
		inc = factors(i, inc)
	print(len(inc))
	for i in inc:
		print(i, end=' ')
	if mode == 'file':
		f.close()
main()


n = int(input())
li = []
for i in range(1, n + 1):
	(j, c, x) = (1, 0, i)
	for j in range(2, i + 1):
		cc = 0
		while x % j == 0:
			x //= j
			cc += 1
		if cc > 0:
			c += 1
		if c == 1 and x == 1:
			li.append(str(i))
			break
print(len(li))
print(' '.join(li))


n = int(input())

def calcula_divisores(n):
	div = []
	for i in range(2, n // 2 + 1):
		if n % i == 0:
			div.append(i)
	return div
count = 0
adic = True
b = False
per = []
for i in range(2, n + 1):
	div = calcula_divisores(i)
	if len(div) != 0:
		div_desc = sorted(div, reverse=True)
		for p in range(len(div_desc)):
			if b:
				b = False
				break
			if p != len(div_desc) - 1:
				for k in range(p + 1, len(div_desc)):
					if div_desc[p] % div_desc[k] != 0:
						adic = False
						b = True
						break
		if adic or len(div) == 1:
			per.append(i)
			count += 1
	elif len(div) == 0:
		per.append(i)
		count += 1
	adic = True
print(count)
for p in per:
	print(p, end=' ')


entrada = int(input())
i = 2
array = [''] * 1005
arr = [''] * 1005
cont = 0
valor = 0
s = 0

def teste(entrada):
	i = 2
	while i * i <= int(entrada):
		if entrada % i == 0:
			return False
		i += 1
	return True
while i < 1005:
	if teste(i):
		array[cont] = i
		cont += 1
	i += 1
for i in range(cont):
	valor = array[i]
	while valor <= entrada:
		arr[s] = valor
		s += 1
		valor = valor * array[i]
	i += 1
print(s)
result = ''
for i in range(s):
	result += str(arr[i]) + ' '
print(result)


import math
numero = int(input())
dados = {}
for i in range(numero + 1):
	dados[i] = False
for i in range(2, numero + 1):
	if dados[i] == False:
		potencia = 2
		while i * potencia <= numero:
			dados[i * potencia] = True
			potencia += 1
primos = []
for i in dados:
	if i != 0 and i != 1 and (dados[i] == False):
		primos.append(i)
perguntas = []
for primo in primos:
	potencia = 1
	while primo ** potencia <= numero:
		perguntas.append(primo ** potencia)
		potencia += 1
print(len(perguntas))
print(*perguntas)


from math import *
from collections import *
from random import *
from bisect import *
import sys
input = sys.stdin.readline
t = 1
while t:
	t -= 1
	n = int(input())
	if n == 1:
		print(0)
		continue
	if n == 2:
		print(1)
		print(2)
		continue
	r = [2]
	for i in range(3, n + 1):
		if i % 2 == 0:
			continue
		c = 0
		for j in range(3, int(pow(i, 0.5)) + 1, 2):
			if i % j == 0:
				c = 1
				break
		if c == 0:
			r.append(i)
	f = set()
	for i in r:
		j = i
		while j <= n:
			f.add(j)
			j = j * i
	print(len(f))
	print(*f)


def main():
	n = int(input()) + 1
	(a, res) = ([True] * n, [])
	for p in range(2, n):
		if a[p]:
			pp = 1
			while pp * p < n:
				pp *= p
				res.append(pp)
			a[p:n:p] = [False] * ((n - 1) // p)
	print(len(res))
	print(*res)
main()


def crivo():
	n = 10000
	pr = [True] * (n + 1)
	pr[0] = pr[1] = False
	for i in range(2, n + 1):
		if pr[i] and i * i <= n:
			for j in range(i * i, n + 1, i):
				pr[j] = False
	return pr
l = crivo()
pr = []
for i in range(len(l)):
	if l[i]:
		pr.append(i)
n = int(input())
res = []
i = 0
while pr[i] <= n:
	k = pr[i]
	while k <= n:
		res.append(k)
		k = k * pr[i]
	i += 1
print(len(res))
print(' '.join([str(i) for i in res]))


import itertools

def erat2():
	D = {}
	yield 2
	for q in itertools.islice(itertools.count(3), 0, None, 2):
		p = D.pop(q, None)
		if p is None:
			D[q * q] = q
			yield q
		else:
			x = p + q
			while x in D or not x & 1:
				x += p
			D[x] = p

def get_primes_erat(n):
	return list(itertools.takewhile(lambda p: p < n, erat2()))
n = int(input())
x = get_primes_erat(n + 1)
a = []
for i in x:
	N = 1
	while i ** N <= n:
		a.append(i ** N)
		N += 1
print(len(a))
for i in a:
	print(i, end=' ')


n = int(input())
if n == 1:
	print(0)
	exit(0)
elif n == 2:
	print(1)
	print(2)
	exit(0)
ans = 0
pr = [0] * (n + 1)
p = []
end = 1
while end > 0:
	i = 2
	while pr[i] != 0:
		i += 1
		if i == n + 1:
			end = 0
			break
	if i != n + 1:
		pr[i] = 1
		p.append(i)
	j = i
	while i + j <= n:
		i += j
		pr[i] = 2
res = []
for a in p:
	x = a
	while x <= n:
		res.append(x)
		ans += 1
		x *= a
print(ans)
print(*res)


N = int(input())
is_prime = [True] * (N + 1)
primes = set()
for i in range(2, N + 1):
	if is_prime[i]:
		for j in range(i, N + 1, i):
			is_prime[j] = False
		primes.add(i)
ans = set()
for p in primes:
	for k in range(1, N + 1):
		if p ** k <= N:
			ans.add(p ** k)
		else:
			break
print(len(ans))
print(' '.join((str(x) for x in ans)))


n = int(input())
ans = []
isprime = [True] * 1001
(isprime[0], isprime[1]) = (False, False)
for i in range(2, n + 1):
	if isprime[i]:
		for j in range(i * i, n + 1, i):
			isprime[j] = False
for i in range(2, n + 1):
	if isprime[i]:
		ans += [int(pow(i, x)) for x in range(1, 10) if int(pow(i, x)) <= n]
print(len(ans))
print(*ans)


def sieve(a, b):
	m = []
	if b != 1:
		if a == 1:
			a += 1
		primes = [1] * (b + 1)
		primes[0] = 0
		primes[1] = 0
		for i in range(2, b + 1):
			if primes[i] == 1:
				for j in range(2 * i, b + 1, i):
					primes[j] = 0
		for i in range(a, b + 1):
			if primes[i] == 1:
				m.append(i)
		return m
	elif a == 1 and b == 1:
		return
n = int(input())
k = 0
ans = []
if n == 1:
	print(k)
else:
	mas = sieve(2, n)
	for i in mas:
		j = i
		ans.append(j)
		k += 1
		while n >= j * i:
			j *= i
			ans.append(j)
			k += 1
	print(k)
	print(*ans)


n = int(input())
ans = []
p = [0] * (n + 1)
for i in range(2, n):
	if p[i] == 0:
		for j in range(2 * i, n + 1, i):
			p[j] = 1
primes = []
for i in range(2, n + 1):
	if p[i] == 0:
		primes.append(i)
for i in primes:
	c = 1
	while i ** c <= n:
		ans.append(i ** c)
		c += 1
print(len(ans))
print(*ans)


def gerap(MAX):
	MAX += 1
	resposta = []
	primos = [True] * MAX
	primos[0] = False
	primos[1] = False
	for i in range(2, MAX, 1):
		if primos[i]:
			elevado = 1
			while elevado * i < MAX:
				elevado *= i
				resposta.append(str(elevado))
			for j in range(i * 2, MAX, i):
				primos[j] = False
	return resposta
a = int(input())
primos = gerap(a)
print(len(primos))
print(' '.join(primos))


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
primes = SieveOfEratosthenes(1000)
a = []
for i in range(len(primes)):
	if primes[i] == True:
		a.append(i)
set1 = set()
for i in range(len(a)):
	for j in range(i + 1, len(a)):
		set1.add(a[i] * a[j])
n = INT()
l = set()
for i in range(2, n + 1):
	if primes[i]:
		pw = 1
		while True:
			if i ** pw <= n:
				l.add(i ** pw)
				pw += 1
			else:
				break
print(len(l))
print(*l)


n = int(input())
r = []
is_prime = lambda x: x <= 10 and x in [2, 3, 5, 7] or (x > 10 and all((x % i > 0 for i in range(2, int(x ** 0.5) + 1))))
for i in range(2, n + 1):
	if not is_prime(i):
		continue
	k = i
	while k <= n:
		r.append(k)
		k *= i
print(len(r))
print(*r)


n = int(input().strip())
num = [1 for x in range(n + 1)]
num[0] = num[1] = 0
ans = 0
for x in range(2, n + 1, 1):
	if num[x] == 1:
		ans += 1
	for y in range(2, x, 1):
		if x % y != 0 and x * y <= n:
			num[x * y] = 0
print(ans)
for x in range(n + 1):
	if num[x] == 1:
		print(x, end=' ')


y = int(input())
a = [2]
for i in range(3, y + 1, 2):
	isprime = True
	for j in a:
		if i % j == 0:
			isprime = False
			break
	if isprime == True:
		a.append(i)
ans = []
for i in a:
	g = i
	while g <= y:
		ans.append(g)
		g = g * i
print(len(ans))
for i in ans:
	print(i, '', end='')


import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import Counter
from math import gcd
n = int(input())
bd = n
ar = [1] * (bd + 1)
for i in range(2, int(bd ** (1 / 2)) + 1):
	if ar[i] == 1:
		for j in range(i * i, bd + 1, i):
			ar[j] = 0
a = []
for i in range(2, n + 1):
	if ar[i] == 1:
		t = i
		while t <= n:
			a.append(t)
			t *= i
print(len(a))
print(*a)


import math
import sys

def crivo_de_erastotenes(entrada):
	numeros = [True] * (entrada + 1)
	raiz_meiota = int(math.sqrt(entrada))
	for j in (i for i in range(2, raiz_meiota + 1) if numeros[i]):
		for k in range(j * j, entrada + 1, j):
			numeros[k] = False
	return [i for i in range(2, entrada + 1) if numeros[i]]

def resolucao(numero):
	sim = []
	for i in crivo_de_erastotenes(numero):
		sim.append(i)
		atual = i * i
		while atual <= numero:
			sim.append(atual)
			atual *= i
	return sim

def print_stderr(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)
entrada = int(input())
resposta = resolucao(entrada)
print(len(resposta))
print(' '.join((str(i) for i in resposta)))


def prime(x):
	i = 2
	while i * i <= x:
		if x % i == 0:
			return False
		i += 1
	return True
n = int(input())
ans = []
for i in range(2, n + 1):
	if not prime(i):
		continue
	k = i
	while k <= n:
		ans.append(k)
		k *= i
print(len(ans))
print(*ans)


n = int(input())
p = []
for i in range(2, n + 1):
	isprime = True
	for j in p:
		if i % j == 0:
			isprime = False
			break
	if isprime:
		p.append(i)
ans = []
for i in p:
	k = 1
	while i ** k <= n:
		ans.append(str(i ** k))
		k += 1
print(len(ans))
print(' '.join(ans))


from math import log, floor
t = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
n = int(input())
ans = []
for i in t:
	if i > n:
		break
	for a in range(1, floor(log(n, i)) + 1):
		ans.append(i ** a)
print(len(ans))
print(*ans)


n = int(input())
z = []
t = [False for i in range(n + 1)]
for i in range(1, n + 1):
	k = 0
	for j in range(1, i + 1):
		if i % j == 0:
			k += 1
	if k == 2:
		t[i] = True
for i in range(1, n + 1):
	if t[i]:
		k = 1
		v = i
		while v <= n:
			z += [v]
			v *= i
print(len(z))
for i in range(len(z)):
	print(z[i], end=' ')


__author__ = 'dwliv_000'

def isPrime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True
n = int(input())
z = []
for c in range(2, n + 1):
	if isPrime(c):
		for j in range(1, 11):
			if c ** j <= n:
				z.append(c ** j)
print(len(z))
for j in range(len(z)):
	print(z[j], end=' ')


from math import sqrt

def primes(n):
	primos = []
	ehPrimo = [True] * (n + 1)
	ehPrimo[0] = False
	ehPrimo[1] = False
	for i in range(2, n + 1):
		if ehPrimo:
			primos.append(i)
			for j in range(i * 2, n + 1, i):
				ehPrimo[j] = False
	return primos

def fatoresPrimos(n):
	primos = primes(n)
	index = 0
	pf = primos[index]
	fatores = []
	while n != 1 and pf * pf <= n:
		while n % pf == 0:
			n //= pf
			fatores.append(pf)
		index += 1
		pf = primos[index]
	if n != 1:
		fatores.append(n)
	return fatores
n = int(input())
ans = []
for i in range(2, n + 1):
	pf = fatoresPrimos(i)
	if len(pf) == 1:
		ans.append(i)
	elif sum(pf) / len(pf) == pf[0]:
		ans.append(i)
print(len(ans))
print(' '.join(map(str, ans)))


def eratosthenes():
	sieve = list(range(n + 1))
	sieve[1] = 0
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sieve
n = int(input())
a = eratosthenes()
res = []
for elem in a:
	if elem == 0:
		continue
	x = elem
	while x <= n:
		res.append(x)
		x *= elem
print(len(res))
print(' '.join(list(map(str, res))))


n = int(input())
quest = []
for i in range(2, n + 1):
	if all((i % q != 0 for q in quest)):
		x = i
		while x <= n:
			quest.append(x)
			x *= i
print(len(quest))
print(' '.join((str(q) for q in quest)))


def get_primes(k):
	p = [True] * (k + 1)
	p[0] = False
	p[1] = False
	for i in range(1, k + 1):
		if p[i]:
			for j in range(2, k // i + 1):
				p[i * j] = False
	pr = []
	for i in range(k + 1):
		if p[i]:
			pr.append(i)
	return pr
n = int(input())
p = get_primes(n + 2)
from math import log, floor
s = 0
b = []
for x in p:
	k = floor(log(n) / log(x))
	s += k
	for i in range(1, k + 1):
		b.append(int(x ** i))
print(int(s))
for x in b:
	print(x, end=' ')
print()


from sys import stdin

def main():
	n = int(stdin.readline())
	check = [True] * 1001
	check[0] = False
	check[1] = False
	index = 2
	while index * index <= 1000:
		if check[index]:
			for j in range(index * index, 1001, index):
				check[j] = False
		index += 1
	prime = []
	for i in range(2, 1001):
		if check[i]:
			prime.append(i)
	ans = []
	count = 0
	for i in range(len(prime)):
		if prime[i] <= n:
			curr = prime[i]
			while curr <= n:
				count += 1
				ans.append(curr)
				curr = curr * prime[i]
		else:
			break
	print(count)
	print(*ans)
main()


from sys import stdin
stdin.readline

def mp():
	return list(map(int, stdin.readline().strip().split()))

def it():
	return int(stdin.readline().strip())
from collections import defaultdict as dd
n = it()
l = [0] * (n + 1)
v = []
for i in range(2, n + 1):
	j = i
	while j < n + 1:
		if not l[j]:
			l[j] = 1
			v.append(j)
		j *= i
	for k in range(i, n + 1, i):
		l[k] = 1
v.sort()
print(len(v))
print(*v)


import math
n = int(input())

def prime(n):
	xs = int(math.sqrt(n))
	for i in range(2, xs + 1):
		if n % i == 0:
			return False
	return True
ls = []
for i in range(2, n + 1):
	if prime(i):
		ls.append(i)
temp = []
for i in range(len(ls)):
	xs = ls[i]
	j = xs * xs
	while j <= n:
		temp.append(j)
		j = xs * j
ls = ls + temp
print(len(ls))
print(*ls)


from sys import stdin
input = stdin.readline

def is_prime(x):
	if x == 2 or x == 3:
		return True
	if x % 2 == 0:
		return False
	i = 1
	while i ** 2 <= x:
		i += 2
		if x % i == 0:
			return False
	return True
n = int(input())
ans = []
for i in range(2, n + 1):
	if is_prime(i):
		p = i
		ans.append(p)
		while p <= n // i:
			p *= i
			ans.append(p)
print(len(ans))
print(*ans)


import math
primes = []

def gcd(a, b):
	if a == 0:
		return b
	else:
		return gcd(b % a, a)

def isAnswer(primes, i):
	factors = []
	for num in primes:
		if num > i:
			break
		elif i % num == 0:
			factors.append(i)
	flag = True
	for i in range(1, len(factors)):
		if gcd(factors[i - 1], factors[i]) != 1:
			flag = False
			break
	return flag

def sieve(n):
	prime = [True] * 1005
	prime[0] = False
	prime[1] = False
	for i in range(2, int(math.sqrt(1005)) + 1):
		if prime[i] == True:
			for j in range(i * i, 1005, i):
				prime[j] = False
	for i in range(n + 1):
		if prime[i] == True:
			primes.append(i)
	ans = []
	for i in range(2, n + 1):
		if prime[i] == False:
			if isAnswer(primes, i):
				ans.append(i)
	print(len(ans) + len(primes))
	primes.extend(ans)
	print(*primes)
n = int(input())
sieve(n)


is_prime = lambda n: all((n % d for d in range(2, int(n ** 0.5) + 1)))
(n, Y) = (int(input()), [])
for i in range(2, n + 1):
	if is_prime(i):
		y = i
		while y <= n:
			Y.append(y)
			y *= i
print(len(Y))
print(*Y)


n = int(input())
primes = []
is_prime = (n + 1) * [True]
is_prime[0] = is_prime[1] = False
pos = 0
while True:
	while pos <= n and (not is_prime[pos]):
		pos += 1
	if pos > n:
		break
	for i in range(2 * pos, n + 1, pos):
		is_prime[i] = False
	primes.append(pos)
	pos += 1

def get_factors(x):
	factors = []
	for factor in primes:
		if x % factor == 0:
			factors.append(factor)
	return factors
ask = []
for x in range(2, n + 1):
	factors = get_factors(x)
	if len(factors) == 1:
		ask.append(x)
print(len(ask))
print(' '.join(map(str, ask)))


def is_prime(n):
	for i in range(2, n):
		if n % i == 0:
			return 0
			break
	return 1
n = int(input())
if n == 1:
	print(0)
else:
	q = []
	for i in range(2, n + 1):
		if is_prime(i):
			q.append(i)
			k = i
			while 1:
				k = k * i
				if k <= n:
					q.append(k)
				else:
					break
	print(len(q))
	for i in q:
		print(i, end=' ')


import sys
input = sys.stdin.readline
n = int(input())
if n == 1:
	print(0)
	print()
	exit()
no = [2]
for i in range(3, n + 1):
	for pr in no:
		if i % pr == 0:
			break
	else:
		no.append(i)
left = []
for el in no:
	k = el
	while k * el <= n:
		k *= el
		left.append(k)
print(len(no) + len(left))
print(*no, *left)


def easy(n):
	for i in range(2, n // 2 + 1):
		if n % i == 0:
			return False
	return True
n = int(input())
if n == 1:
	print(0)
else:
	ans = []
	for i in range(2, n + 1):
		if easy(i):
			j = i
			while j <= n:
				ans.append(j)
				j *= i
	print(len(ans))
	print(*ans)


n = int(input())

def check(x, y):
	while x % y == 0:
		x /= y
	if x == 1:
		return True
	else:
		return False
aux = [0] * 10 ** 4
res = []
count = 0
for i in range(2, n + 1):
	if aux[i] == 0:
		count += 1
		res.append(i)
		j = 2
		while i * j <= n:
			if check(j, i):
				count += 1
				res.append(j * i)
			aux[j * i] = 1
			j += 1
print(count)
print(*res)


n = int(input())
a = ' '.join([' '.join([str(i ** k) for k in range(1, 30) if i ** k <= n]) for i in range(2, n + 1) if all([i % j != 0 for j in range(2, i)])])
print(len(a.split()), '\n' + a)


import sys
from collections import defaultdict

def primeSieve(n):
	cache = defaultdict(list)
	cache[2].append(2)
	primes = [2]
	for i in range(2, n + 1):
		if i in cache:
			for ele in cache[i]:
				cache[i + ele].append(ele)
			del cache[i]
		else:
			primes.append(i)
			cache[i + i].append(i)
	return primes

def solve(n):
	questions = 0
	questionList = []
	primes = primeSieve(n)
	for prime in primes:
		power = 1
		k = prime ** power
		while k <= n:
			questionList.append(k)
			power += 1
			k = prime ** power
	questions = len(questionList)
	return (questions, questionList)

def readinput():
	k = int(input())
	(ans, lst) = solve(k)
	print(ans)
	for i in range(len(lst)):
		if i != len(lst) - 1:
			print(lst[i], end=' ')
		else:
			print(lst[i], end='\n')
readinput()


n = int(input())
s_p = set((i for i in range(2, n + 1)))
for i in range(2, int(n ** (1 / 2)) + 1):
	if i in s_p:
		for j in range(2, n // i + 1):
			if i * j in s_p:
				s_p.remove(i * j)
l_o = list()
for i in s_p:
	c_e = i
	while i <= n:
		l_o.append(i)
		i *= c_e
print(len(l_o))
print(' '.join((str(x) for x in l_o)))


n = int(input())
is_prime = [True] * (n + 1)
primes = []
for i in range(2, n + 1):
	if is_prime[i]:
		primes.append(i)
		for j in range(i + i, n + 1, i):
			is_prime[j] = False
output = ''
num = 0
for prime in primes:
	prime_calc = prime
	while prime_calc <= n:
		num += 1
		output += str(prime_calc) + ' '
		prime_calc *= prime
print(num)
print(output)


import math
n = int(input())
m = 1
ans = []

def is_prime(number):
	for i in range(2, int(math.sqrt(number)) + 1):
		if number % i == 0:
			return False
	return True
for el in range(2, n + 1):
	if is_prime(el):
		candidate = el
		while candidate <= n:
			ans.append(str(candidate))
			candidate *= el
print(len(ans))
print(' '.join(ans))


n = int(input())
questions = []
for i in range(2, n + 1):
	l = list((i % q for q in questions))
	if all(l):
		x = i
		while x <= n:
			questions.append(x)
			x *= i
print(len(questions))
print(' '.join((str(q) for q in questions)))


def is_prime(n):
	if n == 2:
		return True
	elif n < 2 or n % 2 == 0:
		return False
	elif all((n % i != 0 for i in range(3, int(n ** 0.5) + 1, 2))):
		return True
	return False
(n, t, l) = (int(input()), 0, [])
for x in range(2, n + 1):
	if is_prime(x):
		k = 1
		while x ** k <= n:
			l.append(str(x ** k))
			k += 1
			t += 1
print(t, ' '.join(l), sep='\n')


import sys
import string
import math
import heapq
from collections import defaultdict
from functools import lru_cache
from collections import Counter
from fractions import Fraction

def mi(s):
	return map(int, s.strip().split())

def lmi(s):
	return list(mi(s))

def tmi(s):
	return tuple(mi(s))

def mf(f, s):
	return map(f, s)

def lmf(f, s):
	return list(mf(f, s))

def js(lst):
	return ' '.join((str(d) for d in lst))

def jsns(lst):
	return ''.join((str(d) for d in lst))

def line():
	return sys.stdin.readline().strip()

def linesp():
	return line().split()

def iline():
	return int(line())

def mat(n):
	matr = []
	for _ in range(n):
		matr.append(linesp())
	return matr

def matns(n):
	mat = []
	for _ in range(n):
		mat.append([c for c in line()])
	return mat

def mati(n):
	mat = []
	for _ in range(n):
		mat.append(lmi(line()))
	return mat

def pmat(mat):
	for row in mat:
		print(js(row))

def fast_exp(x, n, m):
	if n == 0:
		return 1
	elif n % 2 == 1:
		return x * fast_exp(x, (n - 1) // 2, m) ** 2 % m
	else:
		return fast_exp(x, n // 2, m) ** 2 % m

def factorize(n):
	factors = []
	i = 2
	while i * i <= n:
		while n % i == 0:
			factors.append(i)
			n //= i
		i += 1
	if n > 1:
		factors.append(n)
	return factors

def main():
	n = iline()
	maps = defaultdict(list)
	for i in range(2, n + 1):
		fac = factorize(i)
		maps[tuple(fac)].append(i)
	ans = []
	for tup in maps:
		if len(tup) == 1:
			ans.extend(maps[tup])
		elif len(set(tup)) == 1:
			ans.append(tup[0] ** len(tup))
	print(len(ans))
	if ans:
		print(js(ans))
main()


import math
import sys
import collections
import bisect
import string
import time

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	ans = []
	for p in range(n + 1):
		if prime[p]:
			ans.append(p)
	return ans
for tc in range(1):
	n = int(input())
	primes = SieveOfEratosthenes(n)
	ans = []
	for i in primes:
		no = i
		power = 1
		while no ** power <= n:
			ans.append(no ** power)
			power += 1
	print(len(ans))
	print(*ans)


import unittest
import sys

class Game:

	def __init__(self, test_inputs=None):
		it = iter(test_inputs.split('\n')) if test_inputs else None

		def uinput():
			return next(it) if it else sys.stdin.readline().rstrip()
		[self.n] = map(int, uinput().split())
		self.sieve(self.n)

	def sieve(self, n):
		self.pf = [0] * (n + 1)
		i = 2
		while i * i <= n:
			if self.pf[i] == 0:
				j = i * i
				while j <= n:
					self.pf[j] = i
					j += i
			i += 1

	def factorize(self, n):
		result = {}
		while n > 1:
			pf = self.pf[n]
			if pf == 0:
				pf = n
			if pf not in result.keys():
				result[pf] = 0
			result[pf] += 1
			n = n // pf
		return result

	def calculate(self):
		result = []
		for (i, k) in enumerate(self.pf):
			if k != 0 or i < 2:
				continue
			cur = i
			while cur <= self.n:
				result.append(cur)
				cur *= i
		return str(len(result)) + '\n' + ' '.join(map(str, result))

class unitTests(unittest.TestCase):

	def test_single_test(self):
		test = '4'
		d = Game(test)
		self.assertEqual(d.n, 4)
		d = Game('1000')
		self.assertEqual(d.pf[:5], [0, 0, 0, 0, 2])
		self.assertEqual(d.factorize(40), {2: 3, 5: 1})
		self.assertEqual(Game(test).calculate(), '3\n2 4 3')
		test = '6'
		self.assertEqual(Game(test).calculate(), '4\n2 4 3 5')
		test = ''
		test = ''

	def time_limit_test(self, nmax):
		import random
		import timeit
		test = str(nmax) + ' ' + str(nmax) + '\n'
		numnums = [str(i) + ' ' + str(i + 1) for i in range(nmax)]
		test += '\n'.join(numnums) + '\n'
		nums = [random.randint(1, 10000) for i in range(nmax)]
		test += ' '.join(map(str, nums)) + '\n'
		start = timeit.default_timer()
		d = Game(test)
		calc = timeit.default_timer()
		d.calculate()
		stop = timeit.default_timer()
		print('\nTimelimit Test: ' + '{0:.3f}s (init {1:.3f}s calc {2:.3f}s)'.format(stop - start, calc - start, stop - calc))
sys.setrecursionlimit(100000)
if sys.argv[-1] == '-ut':
	unittest.main(argv=[' '])
sys.stdout.write(Game().calculate())


n = int(input())
primos = [1] * (n + 1)
primos[0] = 0
primos[1] = 0
for i in range(2, n):
	if primos[i] == 1:
		for j in range(i * i, n + 1, i):
			primos[j] = 0
for i in range(2, n + 1):
	if primos[i] == 1:
		primos[i] = i
		q = 2
		j = i ** q
		while j < n + 1:
			j = i ** q
			if j >= n + 1:
				break
			primos[j] = j
			q += 1
s = []
for k in range(len(primos)):
	if primos[k] != 0:
		s.append(primos[k])
print(len(s))
print(*s)


n = int(input())
a = list(range(n + 1))
a[1] = 0
lst = []
i = 2
while i <= n:
	if a[i] != 0:
		lst.append(a[i])
		for j in range(i, n + 1, i):
			a[j] = 0
	i += 1
for i in range(len(lst)):
	x = lst[i]
	m = x
	while m * x <= n:
		lst.append(m * x)
		m *= x
print(len(lst))
print(' '.join(map(str, lst)))


def SieveOfEratosthenes(n, ans):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n):
		if prime[p]:
			ans.append(p)
n = int(input())
prime = []
ans = []
SieveOfEratosthenes(n + 1, prime)
for i in prime:
	k = 1
	pow = i
	while pow <= n:
		ans.append(str(pow))
		k += 1
		pow = i ** k
print(len(ans))
print(' '.join(ans))


is_prime = [0] * 1010
qtd_primos = [0] * 1010

def primes():
	for i in range(2, 1001):
		if is_prime[i] == 0:
			is_prime[i] = 1
			for j in range(i * 2, 1001, i):
				is_prime[j] = -1
				qtd_primos[j] += 1
n = int(input())
primes()
ans = ''
qtd = 0
for i in range(2, n + 1):
	if is_prime[i] == 1 or qtd_primos[i] == 1:
		ans += str(i) + ' '
		qtd += 1
print(qtd)
print(ans)


import math
import array

def is_prime(x):
	i = 2
	while i <= math.sqrt(x):
		if x % i == 0:
			return False
		i = i + 1
	return True
answer_list = []
n = int(input())
i = 2
answer = 0
while i <= n:
	if is_prime(i):
		answer = answer + 1
		answer_list.append(i)
		j = i * i
		while j <= n:
			answer = answer + 1
			answer_list.append(j)
			j = j * i
	i = i + 1
print(answer)
for x in answer_list:
	print(x, end=' ')


n = int(input())
primos = []
composto = [False] * (10 ** 3 + 7)
for i in range(2, 10 ** 2, 1):
	if not composto[i]:
		for j in range(i + i, 10 ** 3 + 7, i):
			composto[j] = True
for i in range(2, 10 ** 3 + 7, 1):
	if not composto[i]:
		primos.append(i)
ans = []
for p in primos:
	if p > n:
		break
	i = 1
	while p ** i <= n:
		ans.append(p ** i)
		i += 1
print(len(ans))
for num in ans:
	print(num, end=' ')
exit(0)


from math import sqrt
from math import sqrt

def crivo(DIM):
	lim = int(sqrt(DIM)) + 1
	vals = [True] * DIM
	vals[0] = False
	vals[1] = False
	for i in range(2, lim):
		if vals[i]:
			for j in range(i * i, DIM, i):
				vals[j] = False
	return [i for i in range(len(vals)) if vals[i]]
num = int(input())
primos = crivo(num + 1)
ans = []
for e in primos:
	ans.append(str(e))
	atual = e * e
	while atual <= num:
		ans.append(str(atual))
		atual *= e
print(len(ans))
print(' '.join(ans))


inpt = input()
x = int(inpt)

def primo(numero):
	if numero == 2:
		return 'dead'
	for numer in range(2, int(pow(numero, 0.5)) + 1):
		if numero % numer == 0:
			return 'luv'
	return 'dead'
muchos_numeros = []
for i in range(2, 1000):
	if primo(i) == 'dead':
		for mucho in [1, 3, 3, 7, 4, 2, 5, 8, 6, 9]:
			muchos_numeros.append(pow(i, mucho))
todos_los_numeros = []
if inpt == 182:
	print('HACK ME OR WAT .___.')
muchos_numeros = set(muchos_numeros)
muchos_numeros = list(muchos_numeros)
for numero in muchos_numeros:
	if numero <= x:
		todos_los_numeros.append(numero)
print(len(todos_los_numeros))
todos_los_numeros.sort()
estrenga = ''
for numero in todos_los_numeros:
	estrenga = estrenga + str(numero) + ' '
print(estrenga)


n = int(input())
items = set()
for j in range(2, n + 1):
	num = j
	i = 2
	while i <= num:
		if num % i == 0:
			val = 1
			while num % i == 0:
				val *= i
				num = num // i
			items.add(val)
		i += 1
		items.add(val)
print(len(items))
for x in items:
	print(x, end=' ')


n = int(input())
prime = [False] * (n + 1)
ans = []
for i in range(2, n + 1):
	if prime[i]:
		continue
	x = i
	while x <= n:
		ans.append(x)
		prime[x] = True
		x *= i
	x = i
	while x <= n:
		prime[x] = True
		x += i
print(len(ans))
for x in ans:
	print(x, end=' ')


n = int(input())
a = [0] * (n + 1)
nto = [1] * (n + 1)
nto[0] = nto[1] = 0
for i in range(2, n + 1):
	if nto[i] == 1:
		k = 2
		while k * i <= n:
			nto[k * i] = 0
			k += 1
dem = 0
for i in range(n + 1):
	if nto[i] == 1:
		k = 1
		while i ** k <= n:
			a[i ** k] = 1
			k += 1
			dem += 1
print(dem)
for i in range(n + 1):
	if a[i] == 1:
		print(str(i), end=' ')


def is_pri(n):
	f = 0
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			f = 1
			break
	if f == 0:
		return True
	else:
		return False

def pri(n):
	r = []
	for i in range(2, n + 1):
		if is_pri(i) == True:
			r.append(i)
	return r
n = int(input())
a = pri(n)
r = []
for i in a:
	j = 1
	while i ** j <= n:
		r.append(i ** j)
		j = j + 1
print(len(r))
for i in r:
	print(str(i) + ' ', end='')


import sys
from copy import *
from bisect import *

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def bo(i):
	return ord(i) - ord('A')

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j):
	return 0 <= i < n and 0 <= j < m and (a[i][j] != '.')

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = 1

def prime(p):
	for i in range(2, p):
		if p % i == 0:
			return False
	return True
while t > 0:
	t -= 1
	n = fi()
	ans = []
	for p in range(2, n + 1):
		if prime(p):
			i = p
			while i <= n:
				ans.append(i)
				i *= p
	print(len(ans))
	print(*ans)


from math import *
N = 1000
P = {2, 3}
for i in range(5, N + 1):
	for j in range(2, int(sqrt(i)) + 1):
		if i % j == 0:
			break
	else:
		P.add(i)
D = set()
for p in P:
	a = p
	while a <= N:
		D.add(a)
		a *= p
n = int(input())
d = [i for i in D if i <= n]
print(len(d))
print(' '.join(map(str, d)))


def is_prime(x):
	i = 2
	while i * i <= x:
		if x % i == 0:
			return False
		i += 1
	return True

def primes():
	i = 2
	while True:
		if is_prime(i):
			yield i
		i += 1
import itertools
n = int(input())
guesses = []
for p in itertools.takewhile(lambda p: p <= n, primes()):
	x = p
	while x <= n:
		guesses.append(x)
		x *= p
print(len(guesses))
print(' '.join(map(str, guesses)))


def sieve(n):
	prime = [True] * (n + 1)
	prime[0] = prime[1] = False
	i = 2
	while i * i <= n:
		if prime[i]:
			for j in range(i * i, n + 1, i):
				prime[j] = False
		i += 1
	return prime
n = int(input())
isPrime = sieve(n)
ret = []
for i in range(n + 1):
	if isPrime[i]:
		p = 1
		while i ** p <= n:
			ret.append(i ** p)
			p += 1
print('%d\n%s' % (len(ret), ' '.join(map(str, ret))))


import math
n = int(input())
tt = n

def prime(n):
	if n < 2:
		return []
	ans = []
	s = [i + 2 for i in range(n - 1)]
	k = math.sqrt(n)
	p = 0
	value = 0
	while s[value] <= k:
		p = value
		while p <= n - 1:
			p = p + s[value]
			if p < len(s):
				s[p] = -1
		i = 0
		while i < len(s):
			if s[i] != -1 and i > value:
				value = i
				break
			i += 1
	for i in s:
		if i != -1:
			ans.append(i)
	return ans
s = prime(n)
i = 0
if len(s) == 0:
	print(0)
else:
	ans = 0
	array = []
	for pr in s:
		ppol = pr
		while pr <= tt:
			array.append(pr)
			pr = pr * ppol
			ans += 1
	print(ans)
	for i in array:
		print(i, end=' ')


import math
import array

def is_prime(x):
	i = 2
	while i <= math.sqrt(x):
		if x % i == 0:
			return False
		i = i + 1
	return True
primel = [0 for c in range(1000)]
prime = array.array('i', primel)
n = int(input())
i = 2
answer = 0
while i <= n:
	if prime[i - 1] == 1:
		i = i + 1
		continue
	if is_prime(i):
		answer = answer + 1
		prime[i - 1] = 1
		j = i * i
		while j <= n:
			prime[j - 1] = 1
			answer = answer + 1
			j = j * i
	i = i + 1
i = 2
print(answer)
while i <= n:
	if prime[i - 1]:
		print(i, end=' ')
	i = i + 1


def isPrime(m):
	for j in range(2, int(m ** 0.5) + 1):
		if m % j == 0:
			return False
	return True
n = int(input())
count = 0
mas = []
for i in range(2, n + 1):
	if isPrime(i):
		step = 1
		while i ** step <= n:
			count += 1
			mas.append(i ** step)
			step += 1
print(count)
print(*mas)


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	if n == 1:
		print(0)
		print()
		return
	ans = []
	allprod = set()
	allprod.add(1)
	for x in range(1, n + 1):
		if x in allprod:
			continue
		else:
			temp = set(allprod)
			for y in temp:
				if y % x == 0 or x % y == 0:
					continue
				else:
					if y * x > 2000:
						continue
					allprod.add(y * x)
			allprod.add(x)
			ans.append(x)
	print(len(ans))
	print(*ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())

def prime(n):
	i = 3
	if n == 2:
		return True
	if n % 2 == 0:
		return False
	while i * i <= n:
		if n % i == 0:
			return False
		i += 2
	return True
pr = [i for i in range(2, n + 1) if prime(i)]
prm = []
for p in pr:
	x = p
	prm.append(x)
	while True:
		x *= p
		if x > n:
			break
		prm.append(x)
print(len(prm))
print(*prm)


def d():
	arr = [[2, 4, 8, 16, 32, 64, 128, 256, 512], [3, 9, 27, 81, 243, 729], [5, 25, 125, 625], [7, 49, 343], [11, 121], [13, 169], [17, 289], [19, 361], [23, 529], [29, 841], [31, 961], [37], [41], [43], [47], [53], [59], [61], [67], [71], [73], [79], [83], [89], [97], [101], [103], [107], [109], [113], [127], [131], [137], [139], [149], [151], [157], [163], [167], [173], [179], [181], [191], [193], [197], [199], [211], [223], [227], [229], [233], [239], [241], [251], [257], [263], [269], [271], [277], [281], [283], [293], [307], [311], [313], [317], [331], [337], [347], [349], [353], [359], [367], [373], [379], [383], [389], [397], [401], [409], [419], [421], [431], [433], [439], [443], [449], [457], [461], [463], [467], [479], [487], [491], [499], [503], [509], [521], [523], [541], [547], [557], [563], [569], [571], [577], [587], [593], [599], [601], [607], [613], [617], [619], [631], [641], [643], [647], [653], [659], [661], [673], [677], [683], [691], [701], [709], [719], [727], [733], [739], [743], [751], [757], [761], [769], [773], [787], [797], [809], [811], [821], [823], [827], [829], [839], [853], [857], [859], [863], [877], [881], [883], [887], [907], [911], [919], [929], [937], [941], [947], [953], [967], [971], [977], [983], [991], [997]]
	n = int(input())
	res = []
	if n == 1:
		return '0\n'
	curr = 1
	while True:
		g = 0
		for x in arr:
			if len(x) > 0:
				y = x[0]
				if curr * y <= n:
					res.append(str(y))
					g += 1
					del x[0]
				else:
					continue
		if g == 0:
			return str(len(res)) + '\n' + ' '.join(res)
print(d())


import math
arr = []

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	for p in range(n + 1):
		if prime[p]:
			arr.append(p)
n = int(input())
SieveOfEratosthenes(n)
final = []
for i in arr:
	x = int(math.log(n, i))
	for j in range(1, x + 1):
		final.append(pow(i, j))
print(len(final))
print(*final)


n = int(input())
primos = [1] * (n + 1)
(primos[0], primos[1]) = (0, 0)
for i in range(2, n + 1):
	if primos[i] == 1:
		for j in range(i * i, n + 1, i):
			primos[j] = 0
lista = []
for i in range(2, n + 1):
	if primos[i]:
		num = i
		while num <= n:
			lista.append(num)
			num = num * i
print(len(lista))
print(*lista)


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
n = int(input())
if n == 1:
	print(0)
	exit()
isPrime = sieve(n + 1)
ans = []
for i in range(2, n + 1):
	if isPrime[i]:
		k = i
		while k <= n:
			ans.append(k)
			k *= i
print(len(ans))
print(*ans)


from math import log
n = int(input())
primes = [True for i in range(n + 1)]
i = 2
while i * i <= n:
	if primes[i] == True:
		for j in range(i * 2, n + 1, i):
			primes[j] = False
	i += 1
l = []
s = 0
for p in range(2, n + 1):
	if primes[p] == True:
		k = int(log(n) / log(p))
		s += k
		for m in range(1, k + 1):
			l.append(p ** m)
print(s)
print(*l)


def crivo(numero):
	numeros = [True] * (numero + 1)
	raiz = int(pow(numero, 1 / 2))
	for j in (i for i in range(2, raiz + 1) if numeros[i]):
		for k in range(j * j, numero + 1, j):
			numeros[k] = False
	return [i for i in range(2, numero + 1) if numeros[i]]

def resolucao(numero):
	sim = []
	for i in crivo(numero):
		sim.append(i)
		atual = i * i
		while atual <= numero:
			sim.append(atual)
			atual *= i
	return sim
numero = int(input())
sequencia = resolucao(numero)
print(len(sequencia))
print(' '.join((str(i) for i in sequencia)))


n = int(input())
prostie = []
for i in range(1, n + 1):
	if i == 1:
		continue
	k = 2
	flag = True
	while k * k <= i:
		if i % k != 0:
			k += 1
		else:
			flag = False
			break
	if flag:
		prostie.append(i)
cnt = 0
out = []
for i in range(len(prostie)):
	a = prostie[i]
	summ = a
	while summ <= n:
		out.append(summ)
		summ = summ * a
		cnt += 1
print(cnt)
print(*out)


import math
isprime = [0] * 1000010
prime = []

def seive():
	isprime[1] = isprime[0] = 1
	prime.append(2)
	limit = int(math.sqrt(1000010)) + 2
	for i in range(4, 1000010, 2):
		isprime[i] = 1
	for i in range(3, 1000010, 2):
		if not isprime[i]:
			prime.append(i)
			if i <= limit:
				for j in range(i * i, 1000010, i * 2):
					isprime[j] = 1
seive()
n = int(input())
output_list = []
index = 0
while prime[index] <= n:
	p = 1
	x = pow(prime[index], p)
	while x <= n:
		output_list.append(x)
		p += 1
		x = pow(prime[index], p)
	index += 1
print(len(output_list))
for x in output_list:
	print(x, end=' ')
print()


n = int(input())
pr = {}
for i in range(2, n + 1):
	pr[i] = True
prime = []
for i in range(2, n + 1):
	if pr[i]:
		prime.append(i)
		for j in range(2 * i, n + 1, i):
			pr[j] = False
ans = []
for i in prime:
	j = i
	while j <= n:
		ans.append(j)
		j = j * i
print(len(ans))
print(*ans)


def gen_prime():
	num = [0 for i in range(10 ** 3 + 1)]
	num[2] = 1
	num[3] = 1
	for i in range(4, 10 ** 3 + 1):
		isprime = True
		for j in range(2, int(i ** 0.5) + 1):
			if num[j]:
				if not i % j:
					isprime = False
					break
		if isprime:
			num[i] = 1
	prime = []
	for i in range(2, 10 ** 3 + 1):
		if num[i]:
			prime.append(i)
	return prime
import sys

def inp():
	return sys.stdin.readline().strip()
t = 1
for _ in range(t):
	n = int(input())
	primes = gen_prime()
	ans = []
	a = 0
	for i in primes:
		a = 1
		ii = i
		while ii <= n:
			ans.append(ii)
			ii = ii * i
	print(len(ans))
	print(*ans)


import itertools as it
import functools
import operator
import collections
import math
import sys

def EratosthenesSieve(N):
	numbers = [True] * (N + 1)
	max_p = int(math.sqrt(N))
	for p in (i for i in range(2, max_p + 1) if numbers[i]):
		for q in range(p * p, N + 1, p):
			numbers[q] = False
	return [i for i in range(2, N + 1) if numbers[i]]

def solve(n):
	ys = []
	for i in EratosthenesSieve(n):
		ys.append(i)
		current = i * i
		while current <= n:
			ys.append(current)
			current *= i
	return ys

def print_stderr(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def main():
	n = int(input())
	ys = solve(n)
	print(len(ys))
	print(' '.join((str(i) for i in ys)))
main()


from math import ceil
n = int(input())
prime_arr = [0] * 1001
prime_arr[2] = 1
ans = []
for i in range(3, n + 1):
	prime = True
	for j in range(2, ceil(i ** 0.5) + 1):
		if i % j == 0:
			prime = False
	if prime:
		prime_arr[i] = 1
i = 2
while i <= n:
	if prime_arr[i] == 1:
		k = 1
		while i ** k <= n:
			ans.append(i ** k)
			k += 1
	i += 1
print(len(ans))
print(' '.join(map(str, ans)))


import math

def isPrime(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
n = int(input())
if n == 1:
	print(0)
else:
	primelist = []
	for i in range(2, n + 1):
		if isPrime(i):
			primelist.append(i)
	numguesses = 0
	guesses = []
	for p in primelist:
		check = p
		while check <= n:
			guesses.append(check)
			numguesses += 1
			check *= p
	print(numguesses)
	for x in guesses:
		print(x, end=' ')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

class Prime:

	def __init__(self, n):
		self.M = m = int(math.sqrt(n)) + 10
		self.A = a = [True] * m
		a[0] = a[1] = False
		self.T = t = []
		for i in range(2, int(math.sqrt(m)) + 1):
			if not a[i]:
				continue
			t.append(i)
			for j in range(i * i, m, i):
				a[j] = False
		self.ds_memo = {}
		self.ds_memo[1] = set([1])

	def is_prime(self, n):
		return self.A[n]

def main():
	n = I()
	if n == 1:
		return '0\n'
	r = []
	pr = Prime(n ** 4)
	for i in pr.T:
		if n < i:
			break
		r.append(i)
		j = i * i
		while j <= n:
			r.append(j)
			j *= i
	return '{}\n{}'.format(len(r), ' '.join(map(str, r)))
print(main())


import math
n = int(input())
ans = []
for i in range(2, n + 1):
	c = 1
	for j in range(2, int(math.sqrt(i)) + 1):
		if i % j == 0:
			c = 0
			break
	if c:
		ans.append(i)
ans2 = []
for i in ans:
	ans2.append(i)
	tem = int(math.log(n, i))
	for j in range(2, tem + 1):
		ans2.append(i ** j)
print(len(ans2))
print(*ans2)


n = int(input())
l = [0] * (n + 1)
d = []
for i in range(2, n + 1):
	if l[i] == 0:
		for j in range(i + i, n + 1, i):
			l[j] = 1
		t = i
		while t <= n:
			d.append(t)
			t *= i
print(len(d))
print(*d)


def isprime(n):
	for j in range(2, n):
		if n % j == 0:
			return False
	return True
n = int(input())
lis = []
for m in range(2, n + 1):
	if isprime(m):
		po = m
		while po <= n:
			lis.append(po)
			po *= m
print(len(lis))
if len(lis) == 0:
	exit(0)
lis = [str(j) for j in lis]
print(' '.join(lis))


IL = lambda : list(map(int, input().split()))
I = lambda : int(input())
primes = [True for i in range(1001)]
primes[0] = False
primes[1] = False
for i in range(2, 1001):
	for j in range(i * 2, 1001, i):
		primes[j] = False
primes = [i for (i, p) in enumerate(primes) if p]
for p in primes[:11]:
	ppow = [p ** i for i in range(2, 10) if p ** i <= 1000]
	primes += ppow
primes.sort()
n = I()
ans = [i for i in primes if i <= n]
print(len(ans))
print(' '.join(map(str, ans)))


from sys import *
from math import *
input = lambda : stdin.readline()
int_arr = lambda : list(map(int, stdin.readline().strip().split()))
str_arr = lambda : list(map(str, stdin.readline().split()))
get_str = lambda : map(str, stdin.readline().strip().split())
get_int = lambda : map(int, stdin.readline().strip().split())
get_float = lambda : map(float, stdin.readline().strip().split())
mod = 1000000007
setrecursionlimit(1000)

def countPrimes(n):
	sieve = [True] * n
	lst = []
	for i in range(2, n):
		if sieve[i]:
			lst.append(i)
			for j in range(i * i, n, i):
				sieve[j] = False
	return lst
lst = countPrimes(10 ** 3 + 1)
n = int(input())
ans = []
for i in range(len(lst)):
	if lst[i] > n:
		break
	else:
		ind = 0
		val = lst[i] << ind
		while val <= n:
			ans.append(val)
			ind += 1
			val *= lst[i]
print(len(ans))
print(*ans)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest
INF = 99999999999999999999999999999999

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		n = ri()
		if n == 1:
			print(0)
		else:
			primes = []
			for i in range(2, n + 1):
				j = 2
				flag = 1
				while j * j <= i:
					if i % j == 0:
						flag = 0
						break
					j += 1
				if flag:
					primes.append(i)
			ans = primes.copy()
			for i in primes:
				k = i * i
				while k <= n:
					ans.append(k)
					k *= i
			wi(len(ans))
			wia(ans)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


import sys
inf = float('inf')
(MOD, mod) = (1000000007, 998244353)
from array import array as _array
from bisect import bisect_left, bisect_right

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()

def soe(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	lst = []
	for i in range(2, n + 1):
		if prime[i]:
			lst.append(i)
	return lst
n = int(input())
prime = soe(n)
result = set()
for i in prime:
	j = i
	while j <= n:
		result.add(j)
		j *= i
result = list(result)
print(len(result))
print(*result)


def is_prime(n):
	if n % 2 == 0 and n != 2:
		return False
	d = 3
	while d * d < n and n % d != 0:
		d += 2
	return not n % d == 0 or n == d

def put(p):
	res.append(p)
	curr = p * p
	while curr <= n:
		res.append(curr)
		curr *= p
n = int(input())
res = []
for i in range(2, n + 1):
	if is_prime(i):
		put(i)
print(len(res))
print(' '.join(map(str, res)))


prime = []
f = [0] * 1001
f[0] = f[1] = 1
for i in range(2, 1001):
	if f[i] == 0:
		for j in range(i * i, 1001, i):
			f[j] = 1
n = int(input())
ans = []
for i in range(2, n + 1):
	if f[i] == 0:
		j = i
		while j <= n:
			ans.append(j)
			j *= i
print(len(ans))
print(*ans)


MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
l = []
for i in range(2, 10 ** 3 + 1):
	fg = 0
	for j in range(2, i):
		if i % j == 0:
			fg = 1
			break
	if fg == 0:
		l.append(i)
n = ii()
ans = []
for i in l:
	if i > n:
		break
	x = i
	while x <= n:
		ans.append(x)
		x *= i
print(len(ans))
print(*ans)


def SieveOfEratosthenes(n):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
n = int(input())
prime = [True for i in range(n + 1)]
SieveOfEratosthenes(n)
p = []
for i in range(2, n + 1):
	if prime[i] == True:
		p.append(i)
l = []
for i in p:
	j = 1
	while i ** j <= n:
		l.append(i ** j)
		j += 1
if n == 1:
	print(0)
else:
	print(len(l))
	print(*l)


n = int(input())
t = 0

def prime(n):
	for i in range(2, n):
		if n % i == 0:
			return 0
	return 1
l = []
for i in range(2, n + 1):
	if prime(i) == 1:
		l.append(i)
		k = 2
		while i ** k <= n:
			l.append(i ** k)
			k += 1
print(len(l))
print(*l)


def crivo(n):
	prime = [1] * (n + 1)
	prime[0] = prime[1] = 0
	i = 2
	while i * i <= n:
		if prime[i] == 1:
			for j in range(i * i, n + 1, i):
				prime[j] = 0
		i += 1
	n_primes = []
	for i in range(n + 1):
		if prime[i]:
			n_primes.append(i)
	return n_primes
result = []
n = int(input())
for i in crivo(n):
	j = 1
	while i ** j <= n:
		result.append(i ** j)
		j += 1
print(len(result))
print(*result)


def isPrime(num):
	if num > 1:
		for i in range(2, num // 2 + 1):
			if num % i == 0:
				return False
		return True
	else:
		return False
q = int(input())
l = []
for i in range(1, q + 1):
	if isPrime(i):
		l.append(i)
count = 0
l2 = []
for each in l:
	i = 2
	temp = each
	while temp <= q:
		l2.append(temp)
		temp = each ** i
		i += 1
print(len(l2))
print(*l2)


numberOfPossibilities = int(input())
sieve = [1] * 1001
sieve[0] = 0
sieve[1] = 0
i = 2
while i * i <= 1000:
	if sieve[i] == 1:
		for j in range(i * i, 1001, i):
			sieve[j] = 0
			j += i
	i += 1
questions = ''
numberQuestions = 0
for i in range(2, numberOfPossibilities + 1):
	if sieve[i] == 1:
		questions += str(i) + ' '
		numberQuestions += 1
		power = 2
		currentNumberToPower = pow(i, power)
		while currentNumberToPower <= numberOfPossibilities:
			questions += str(currentNumberToPower) + ' '
			numberQuestions += 1
			power += 1
			currentNumberToPower = pow(i, power)
print(numberQuestions)
print(questions)


n = int(input())
p = [True for _ in range(n + 1)]
l = []
for i in range(2, n + 1):
	if not p[i]:
		continue
	for j in range(i, n + 1, i):
		p[j] = False
	a = i
	while a <= n:
		l.append(a)
		a *= i
print(len(l))
for i in l:
	print(i, end=' ')
print()


__author__ = 'User'
n = int(input())
arr = [[] for i in range(n + 1)]
ans = []
for i in range(2, n + 1):
	if arr[i] == []:
		ans.append(i)
		c = i
		while c * i <= n:
			h = c * i
			arr[h].append(h)
			ans.append(h)
			c *= i
		for j in range(i, n + 1, i):
			arr[j].append(i)
for i in range(n):
	arr[i].sort()
print(len(ans))
print(*ans)


n = int(input())
l = []
for i in range(2, n + 1):
	boolean = True
	for j in range(2, i):
		if i % j == 0:
			boolean = False
	if boolean == True:
		a = i
		while a <= n:
			l.append(a)
			a *= i
l.sort()
count = 0
s = ''
for i in l:
	if i <= n:
		count += 1
		s += str(i) + ' '
print(count)
print(s.rstrip())


n = int(input())
from math import sqrt
a = []
y = ''
if n > 1:
	for i in range(2, n + 1):
		k = 0
		for j in range(2, int(sqrt(i)) + 1):
			if i % j == 0:
				k = 1
		if k == 0:
			a.append(i)
k = 0
for i in range(len(a)):
	for j in range(1, 10):
		if a[i] ** j <= n:
			k = k + 1
			y = y + str(a[i] ** j) + ' '
if n == 1:
	print(0)
else:
	print(k)
	print(y)


import math
import collections

def factorize(n):
	step = lambda x: 1 + (x << 2) - (x >> 1 << 1)
	maxq = int(math.floor(math.sqrt(n)))
	d = 1
	q = n % 2 == 0 and 2 or 3
	while q <= maxq and n % q != 0:
		q = step(d)
		d += 1
	return q <= maxq and [q] + factorize(n // q) or [n]

def primes2(limit):
	if limit < 2:
		return []
	if limit < 3:
		return [2]
	lmtbf = (limit - 3) // 2
	buf = [True] * (lmtbf + 1)
	for i in range((int(limit ** 0.5) - 3) // 2 + 1):
		if buf[i]:
			p = i + i + 3
			s = p * (i + 1) + i
			buf[s::p] = [False] * ((lmtbf - s) // p + 1)
	return [2] + [i + i + 3 for (i, v) in enumerate(buf) if v]
n = int(input())

def solve(n):
	if n == 1:
		print(0)
		return
	primes = primes2(n)
	record = {p: 0 for p in primes}
	for m in range(2, n + 1):
		facs = factorize(m)
		counts = collections.Counter(facs)
		for (p, c) in counts.items():
			if c > record[p]:
				record[p] = c
	q = sum(record.values())
	print(q)
	nums = []
	for (p, c) in record.items():
		for i in range(1, c + 1):
			nums.append(p ** i)
	if q > 0:
		print(*nums)
solve(n)


n = int(input())
isprime = [True for i in range(n + 1)]
for i in range(2, len(isprime)):
	j = i
	while i * j < len(isprime):
		isprime[i * j] = False
		j += 1
ans = []
for i in range(2, len(isprime)):
	if isprime[i]:
		j = 1
		while i * j <= n:
			ans.append(i * j)
			j *= i
print(len(ans))
print(*(x for x in ans))


n = int(input())
l = []
for i in range(2, n + 1):
	for p in l:
		if i % p == 0:
			break
	else:
		el = i
		while el <= n:
			l.append(el)
			el *= i
print(len(l))
print(' '.join([str(i) for i in l]))


import math
import itertools
n = int(input())
primes = [2]
primes_degrees = []
for i in range(3, n + 1):
	for p in itertools.takewhile(lambda x: x <= i ** 0.5, primes):
		if i % p == 0:
			k = i // p
			while k > 1:
				if k % p != 0:
					break
				k = k // p
			else:
				primes_degrees.append(i)
			break
	else:
		primes.append(i)
if n == 1:
	print(0)
else:
	print(len(primes) + len(primes_degrees))
	for p in primes:
		print(p, end=' ')
	for pd in primes_degrees:
		print(pd, end=' ')


n = int(input())

def is_prime(n):
	p = 2
	while p * p <= n:
		if n % p == 0:
			return False
		p += 1
	return True
assert is_prime(7)
assert is_prime(47)
assert is_prime(29)
assert not is_prime(12)
assert not is_prime(49)
asks = []
prime = 2
while prime <= n:
	k = 1
	while prime ** k <= n:
		asks.append(prime ** k)
		k += 1
	prime += 1
	while not is_prime(prime):
		prime += 1
print(len(asks))
for e in asks:
	print(e, end=' ')
print('')


N = int(1000.0 + 3)
prime = [0] * N

def sieve():
	for i in range(2, N):
		if prime[i] >= 1:
			continue
		for j in range(2 * i, N, i):
			prime[j] += 1
sieve()
n = int(input())
res = []
for i in range(2, n + 1):
	if prime[i] <= 1:
		res.append(i)
print(len(res))
print(' '.join(map(str, res)))


def input_ints():
	return list(map(int, input().split()))

def main():
	n = int(input())
	ans = []
	for x in range(2, n + 1):
		s = set()
		xx = x
		for y in range(2, n + 1):
			while xx % y == 0:
				xx /= y
				s.add(y)
		if len(s) == 1:
			ans.append(x)
	print(len(ans))
	print(' '.join((str(x) for x in ans)))
main()


n = int(input())
a = [0] * (n + 1)
b = []
for i in range(2, n + 1):
	if a[i]:
		continue
	ii = 1
	while ii * i <= n:
		ii *= i
		b += [ii]
	j = i
	while j <= n:
		a[j] = 1
		j += i
print(len(b))
print(' '.join(map(str, b)))


def seive(n):
	primes = [True for i in range(n + 1)]
	primes[1] = False
	i = 2
	while i * i <= n:
		if primes[i]:
			for j in range(i * i, n + 1, i):
				primes[j] = False
		i += 1
	return primes
n = int(input())
if n == 1:
	print(0)
	exit(0)
arr = seive(n)
ans = []
for i in range(2, n + 1):
	if arr[i]:
		j = i
		while j <= n:
			ans.append(j)
			j = j * i
print(len(ans))
if len(ans) == 0:
	exit(0)
print(' '.join(map(str, ans)))


import math
n = int(input())
primelist = []
for j in range(2, n + 1):
	div = 0
	for i in range(1, j):
		if j % i == 0:
			div += 1
	if div == 1:
		primelist.append(j)
lim = len(primelist)
for k in primelist:
	if k == primelist[lim - 1]:
		break
	num = int(math.log(n) / math.log(k))
	for l in range(2, num + 1):
		primelist.append(k ** l)
print(len(primelist))
for m in primelist:
	print(m, end=' ')


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(ele, end='\n')

def seive():
	prime = [1 for i in range(10 ** 3 + 1)]
	for i in range(2, 10 ** 3 + 1):
		if prime[i] == 0:
			continue
		for j in range(2 * i, 10 ** 3 + 1, i):
			prime[j] = 0
	return prime
n = L()[0]
P = seive()
primes = []
for i in range(2, n + 1):
	if P[i]:
		primes.append(i)
ans = []
for ele in primes:
	ans.append(ele)
	curr = ele * ele
	while curr <= n:
		ans.append(curr)
		curr *= ele
print(len(ans))
print(*ans)
endtime = time.time()


n = int(input())

def isprime(x):
	for i in range(2, x):
		if x % i == 0:
			return False
	else:
		return True
l = []
for i in range(2, n + 1):
	if isprime(i) == True:
		l.append(i)
l2 = []
for i in l:
	c = 1
	while i ** c <= n:
		l2.append(i ** c)
		c += 1
print(len(l2))
for i in l2:
	print(i, end=' ')


from math import log
ans = 0
n = int(input())
prost = set((i for i in range(2, n + 1)))
for i in range(2, int(n ** 0.5) + 2):
	if i in prost:
		for k in range(i * 2, n + 1, i):
			prost.discard(k)
for i in prost:
	ans += int(log(n, i))
print(ans)
for i in prost:
	k = i
	while n >= i:
		print(i, end=' ')
		i = i * k


def calculate(n):
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True
n = int(input())
(num, count) = (0, 0)
primes = [0] * 1005
ans = [0] * 1005
for i in range(2, 1005):
	if calculate(i):
		primes[num] = i
		num += 1
for i in range(0, num):
	aux = primes[i]
	while aux <= n:
		ans[count] = aux
		count += 1
		aux *= primes[i]
print(count)
answear = ''
space = False
for i in range(0, count):
	if space:
		answear += ' '
	space = True
	answear += str(ans[i])
print(answear)


prime_core = [True for i in range(1001)]
p = 2
while p * p <= 1000:
	if prime_core[p] == True:
		for i in range(p * p, 1001, p):
			prime_core[i] = False
	p += 1
primos = [int(i) for i in range(2, 1001) if prime_core[i]]
n = int(input())
fatores = []
for p in primos:
	pot = p
	if pot > n:
		break
	while pot <= n:
		fatores.append(pot)
		pot *= p
print(len(fatores))
for f in fatores:
	if f == fatores[-1]:
		print(f)
	else:
		print(f, end=' ')


n = int(input())
l = []
for i in range(2, n + 1):
	c = 0
	for x in l:
		if i % x == 0:
			c = 1
			break
	if c == 0:
		v = i
		r = v
		while v <= n:
			l.append(v)
			v = r * v
print(len(l))
print(*l)


import sys
input = sys.stdin.readline
n = int(input())
table = []
for i in range(2, n + 1, 1):
	flag = True
	for j in range(2, i, 1):
		if i % j == 0:
			flag = False
	if flag:
		t = i
		while t <= n:
			table.append(t)
			t *= i
table.sort()
cnt = 0
ans = []
for x in table:
	if x <= n:
		cnt += 1
		ans.append(x)
print(cnt)
for x in table:
	sys.stdout.write(str(x) + ' ')


n = int(input())
a = [True] * (n + 1)
r = []
for i in range(2, n + 1):
	if a[i]:
		j = i
		while j <= n:
			a[j] = False
			j += i
		j = i
		while j <= n:
			r.append(j)
			j *= i
print(len(r))
print(*r)


n = int(input())

def is_prime(n):
	p = 2
	while p * p <= n:
		if n % p == 0:
			return False
		p += 1
	return True
asks = []
prime = 2
while prime <= n:
	k = 1
	while prime ** k <= n:
		asks.append(prime ** k)
		k += 1
	prime += 1
	while not is_prime(prime):
		prime += 1
print(len(asks))
for e in asks:
	print(e, end=' ')
print('')


n = int(input())
primes = []
for i in range(2, n + 1):
	for p in primes:
		if i % p == 0:
			break
	else:
		primes.append(i)
asks = []
for p in primes:
	i = 1
	while p ** i <= n:
		asks.append(p ** i)
		i += 1
print(len(asks))
print(' '.join(map(str, asks)))


def prime(n):
	if n == 2:
		return True
	if n < 2 or n % 2 == 0:
		return False
	i = 3
	while i * i <= n:
		if n % i == 0:
			return False
		i += 2
	return True
(n, ans) = (int(input()), [])
for i in range(2, n + 1):
	if prime(i):
		num = i
		while num <= n:
			ans.append(num)
			num *= i
print(len(ans))
print(*ans)


n = int(input())
a = [1] * (n + 1)
a[0] = 0
a[1] = 0
for i in range(2, n + 1):
	if a[i]:
		for j in range(2, n // i + 1):
			a[i * j] = 0
b = []
for i in range(n + 1):
	if a[i]:
		j = 1
		while j * i <= n:
			j *= i
			b.append(j)
print(len(b))
print(*b)


prime = [2, 3, 5, 7, 11, 13]

def create_list(n):
	nonlocal prime
	for x in range(15, n + 1, 2):
		notPrime = False
		hold = int(x ** 0.5) + 1
		for j in prime:
			if j > hold:
				break
			if x % j == 0:
				notPrime = True
				break
		if notPrime == False:
			prime.append(x)

def main():
	nonlocal prime
	mode = 'filee'
	if mode == 'file':
		f = open('test.txt', 'r')
	if mode == 'file':
		n = int(f.readline())
	else:
		n = int(input())
	create_list(n)
	k = []
	for j in range(len(prime)):
		num = prime[j]
		while num <= n:
			k.append(num)
			num *= prime[j]
		j += 1
	print(len(k))
	for i in k:
		print(i, end=' ')
	if mode == 'file':
		f.close()

def __starting_point():
	main()
__starting_point()


import math
seive = [1] * 1001
seive[0] = seive[1] = 0
for i in range(2, int(math.sqrt(1001))):
	if seive[i] == 1:
		for j in range(i * i, 1001, i):
			seive[j] = 0
n = int(input())
l = []
for i in range(2, n + 1):
	if seive[i] == 1:
		x = i
		while x <= n:
			if x not in l:
				l.append(x)
			x *= i
print(len(l))
for i in l:
	print(i, end=' ')
print()


from math import *
n = int(input())
ar = [0] * (n + 1)
for i in range(2, n + 1):
	if not ar[i]:
		for j in range(i * i, n + 1, i):
			ar[j] = 2
		k = i * i
		while k < n + 1:
			ar[k] = 1
			k = k * i
sol = [i for i in range(2, n + 1) if ar[i] == 0 or ar[i] == 1]
print(len(sol))
print(*sol)


def boleano(inteiro):
	i = 2
	while i * i <= inteiro:
		if inteiro % i == 0:
			return False
		i += 1
	return True
inteiro = int(input())
i = 2
tamanho = 1005
array = [None] * tamanho
arrayAux = [None] * tamanho
pos = 0
while i < tamanho:
	if boleano(i):
		array[pos] = i
		pos += 1
	i += 1
i = 0
aux = 0
while i < pos:
	saida = array[i]
	while saida <= inteiro:
		arrayAux[aux] = saida
		aux += 1
		saida = saida * array[i]
	i += 1
print(aux)
vaipassar = ''
for i in range(aux):
	vaipassar += str(arrayAux[i]) + ' '
print(vaipassar.strip())


n = int(input())
s = [2]
for i in range(3, n + 1, 2):
	c = True
	for j in range(3, int(i ** 0.5 + 1), 2):
		if i % j == 0:
			c = False
			break
	if c:
		s.append(i)
c = []
for j in s:
	i = j
	while i <= n:
		c.append(i)
		i *= j
print(len(c))
print(' '.join(map(str, c)))


import sys
LI = lambda : list(map(int, sys.stdin.readline().strip('\n').split()))
MI = lambda : map(int, sys.stdin.readline().strip('\n').split())
SI = lambda : sys.stdin.readline().strip('\n')
II = lambda : int(sys.stdin.readline().strip('\n'))
n = II()
check = [True] * (n + 1)
primes = []
for i in range(2, n + 1):
	if check[i]:
		primes.append(i)
		for j in range(i + i, n + 1, i):
			check[j] = False
ans = []
for p in primes:
	j = 1
	while p ** j <= n:
		ans.append(p ** j)
		j += 1
print(len(ans))
print(*ans)


from math import sqrt
n = int(input())
ans = []
my_dict = {}

def is_prime(n):
	if n == 2:
		return True
	elif n < 2:
		return False
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
for i in range(2, n + 1):
	if is_prime(i):
		j = 1
		while i ** j <= n:
			if i ** j not in my_dict:
				my_dict[i ** j] = 1
				ans.append(str(i ** j))
			j += 1
print(len(ans))
print(' '.join(ans))


n = int(input())
prime = [True] * (n + 1)
rest = list()
for i in range(2, n + 1):
	if prime[i]:
		for j in range(i * i, n + 1, i):
			prime[j] = False
for i in range(2, n + 1):
	if prime[i]:
		t = i
		while t <= n:
			rest.append(t)
			t *= i
print(len(rest))
print(' '.join(map(str, rest)))


def Sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
n = int(input())
A = Sieve(n)
ans = []
for i in range(2, n + 1):
	if A[i]:
		q = 1
		while q <= n // i:
			q = q * i
			ans.append(q)
print(len(ans))
print(*ans)


def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
import sys
n = int(sys.stdin.readline())
ans = []
for i in range(1, n + 1):
	if isPrime(i):
		k = 1
		while n // i >= k:
			k *= i
			ans.append(k)
print(len(ans))
print(*ans)


def Prime(x):
	for i in range(2, int(x ** 0.5) + 1):
		if x % i == 0:
			return 0
	return 1
n = int(input())
ans = []
for i in range(2, n + 1):
	if Prime(i):
		ans += [str(i)]
		t = i
		while t * i <= n:
			t *= i
			ans += [str(t)]
print(len(ans))
print(' '.join(ans))


n = int(input())
sie = [1] * 1200
prms = []
sie[1] = 0
sie[0] = 0
for i in range(2, 1200):
	if sie[i]:
		for j in range(i * i, 1200, i):
			sie[j] = 0
for i in range(len(sie)):
	if sie[i]:
		prms.append(i)
ans = 0
op = []
for i in range(len(prms)):
	if prms[i] <= n:
		k = 1
		while prms[i] ** k <= n:
			op.append(prms[i] ** k)
			k += 1
			ans += 1
print(ans)
print(*op)


from math import sqrt
n = int(input())
a = []
for i in range(2, n + 1):
	z = 0
	for j in range(2, i):
		y = 0
		for k in range(2, int(sqrt(j)) + 1):
			if j % k == 0:
				y = 1
				break
		if y == 0 and i % j == 0:
			z += 1
	if z < 2:
		a.append(i)
print(len(a))
print(*a)


def seive(r):
	prime = [1 for i in range(r + 1)]
	prime[0] = 0
	prime[1] = 0
	for i in range(r + 1):
		if prime[i]:
			for j in range(2 * i, r + 1, i):
				prime[j] = 0
	return prime

def L():
	return list(map(int, input().split()))
n = int(input())
ans = []
prime = seive(n)
for i in range(n + 1):
	if prime[i]:
		num = 1
		while num <= n // i:
			num *= i
			ans.append(num)
print(len(ans))
print(*ans)


n = int(input())
a = [i + 1 for i in range(n)]
ans = []
for (i, x) in enumerate(a):
	if x != 1:
		ans.append(i + 1)
		for j in range(i, n):
			if a[j] % x == 0:
				a[j] //= x
print(len(ans))
for an in ans:
	print(an, end=' ')


def is_prime(num):
	if num == 0 or num == 1:
		return False
	for x in range(2, num):
		if num % x == 0:
			return False
	else:
		return True
n = int(input())
p = []
if n == 1:
	pass
else:
	p = list(filter(is_prime, range(1, n + 1)))
add = []
for x in p:
	exp = 2
	while x ** exp <= n:
		add.append(x ** exp)
		exp += 1
p += add
print(len(p))
print(' '.join((str(x) for x in p)))


from math import gcd as bltin_gcd

def ci(a, b):
	return bltin_gcd(a, b) == 1
n = int(input())
k = set([i for i in range(2, n + 1)])
for i in range(2, n + 1):
	for j in range(2, n + 1):
		if ci(i, j):
			k.discard(i * j)
k = list(k)
print(len(k))
for i in k:
	print(i, end=' ')


def is_composite(x):
	for i in range(2, x):
		if x % i == 0 and x / i != i:
			while x % i == 0 and x != 1:
				x = int(x / i)
			if x == 1:
				return False
			return True
	return False
n = int(input())
ans = []
for i in range(2, n + 1):
	if not is_composite(i):
		ans.append(str(i))
print(len(ans))
print(' '.join(ans))


n = int(input())
if n == 1:
	print(0)
	print(*[])
else:
	prime = [1] * (n + 1)
	prime[0] = prime[1] = 0
	for i in range(2, int(n ** 0.5) + 1):
		if prime[i] == 1:
			p = 2 * i
			while p <= n:
				if prime[p] == 1:
					prime[p] = 0
				p += i
	l = []
	for i in range(2, n + 1):
		if prime[i] == 1:
			count = 1
			while i ** count <= n:
				l.append(i ** count)
				count += 1
	print(len(l))
	print(*l)


p = 10 ** 3 + 5

def Sieve():
	l = [True] * p
	i = 2
	while i * i <= p:
		if l[i]:
			for j in range(i * i, p, i):
				l[j] = False
		i += 1
	return l
isprime = Sieve()
ans = []
n = int(input())
for i in range(2, n + 1):
	if isprime[i]:
		curr = i
		while curr <= n:
			ans.append(curr)
			curr = curr * i
print(len(ans))
print(*ans)


n = int(input())

def sieve(n):
	a = [False] * (n + 1)
	s = 2
	e = int(n ** (1 / 2)) + 1
	for i in range(s, e):
		if a[i] == False:
			for j in range(i * i, n + 1, i):
				a[j] = True
	li = []
	for i in range(2, n + 1):
		if not a[i]:
			temp = i
			while temp <= n:
				li.append(temp)
				temp *= i
	return li
ans = sieve(n)
print(len(ans))
print(*ans)


(n, s) = (int(input()) + 1, set())
for i in range(2, n):
	for j in range(2, n):
		if not i % j:
			k = i
			while not k % j:
				k //= j
			if k == 1:
				s.add(i)
			break
print(len(s), *s)


def pr(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
n = int(input())
l = pr(n)
l2 = []
for i in range(2, n + 1):
	if l[i]:
		a = 1
		while a * i <= n:
			a *= i
			l2.append(a)
print(len(l2))
print(*l2)


def main():
	n = int(input())
	result = []
	for i in range(2, n + 1):
		j = 2
		while j * j <= i:
			if i % j == 0:
				break
			j += 1
		else:
			j = i
			while j <= n:
				result.append(j)
				j *= i
	print(len(result))
	print(' '.join((str(i) for i in result)))
main()


n = int(input())
primo = [1] * (n + 1)
primo[0] = 0
primo[1] = 0
for i in range(2, n + 1):
	if primo[i] == 1:
		for j in range(i * i, n + 1, i):
			primo[j] = 0
aux = []
for j in range(2, n + 1):
	if primo[j] == 1:
		aux.append(j)
		x = 2
		while j ** x <= n:
			aux.append(j ** x)
			x += 1
print(len(aux))
print(*aux)


def primes(n):
	sieve = set(range(3, n + 1, 2))
	if n >= 2:
		sieve.add(2)
	for i in range(3, int(n ** 0.5) + 1, 2):
		if i in sieve:
			sieve -= set(range(2 * i, n + 1, i))
	return sieve
n = int(input())
res = []
for i in primes(n):
	k = i
	while k <= n:
		res.append(str(k))
		k *= i
print(len(res))
print(' '.join(res))


n = int(input())

def is_prime(x):
	if x == 2:
		return True
	if x == 1 or x % 2 == 0:
		return False
	i = 3
	while i * i <= x:
		if x % i == 0:
			return False
		i += 1
	return True
ans = []
for i in range(2, n + 1):
	if is_prime(i):
		j = i
		while j <= n:
			ans.append(j)
			j *= i
print(len(ans))
print(' '.join(map(str, ans)))


from sys import stdin, setrecursionlimit
import math
from bisect import bisect_right

def get_arr():
	aux = [True for x in range(1001)]
	for i in range(2, 1001):
		if aux[i]:
			for j in range(i * i, 1001, i):
				aux[j] = False
	myset = set()
	for i in range(2, 1001):
		if aux[i] is True:
			j = i
			while j <= 1000:
				myset.add(j)
				j = j * i
	myset = list(myset)
	myset.sort()
	return myset
arr = get_arr()
n = int(stdin.readline().strip())
index = bisect_right(arr, n)
if index == len(arr):
	print(len(arr))
	print(*arr)
else:
	print(index)
	print(*arr[:index])


n = int(input())
if n == 1:
	print(0)
	print('')
else:
	a = []
	for i in range(2, n + 1):
		x = i
		p = 0
		for j in a:
			if x % j == 0:
				p += 1
			while x % j == 0:
				x = x // j
		if x > 1 or (x == 1 and p == 1):
			a.append(i)
	s = str(a[0])
	L = len(a)
	for j in range(1, L):
		s = s + ' ' + str(a[j])
	print(len(a))
	print(s)


def crivo(length):
	result = [1] * length
	(result[0], result[1]) = (0, 0)
	for i in range(2, length, 1):
		if result[i] == 1:
			for j in range(i * 2, length, i):
				result[j] = 0
	return result
n = int(input())
aux = crivo(n + 1)
result = []
for i in range(n + 1):
	if aux[i] == 1:
		power = 1
		while i ** power <= n:
			result.append(i ** power)
			power += 1
print(len(result))
print(' '.join(map(str, result)))


x = int(input())
primos = [True] * (x + 1)
p = 2
res = ''
while p * p <= x and x != 1 and (x != 2):
	if primos[p]:
		for i in range(p * p, x + 1, p):
			primos[i] = False
	p += 1
for primo in range(x + 1):
	if primo == 0 or primo == 1:
		continue
	if primos[primo]:
		(p, aux) = (primo, primo)
		while p <= x:
			res += '%i ' % p
			p *= aux
print(len(res.split()))
print(res[:len(res)])


import math
import sys
n = int(input())
res = []
for i in range(2, n + 1):
	for j in range(2, i + 1):
		if i % j == 0:
			k = i
			while k % j == 0:
				k //= j
			if k == 1:
				res.append(i)
				break
			else:
				break
print(len(res))
for i in range(len(res)):
	print(res[i], end=' ')


def mlt():
	return map(int, input().split())
x = int(input())
prim = [1 for n in range(x + 1)]
dvs = [0 for n in range(x + 1)]
prim[1] = 0
for n in range(1, x + 1):
	if prim[n]:
		dvs[n] = 1
		for k in range(2 * n, x + 1, n):
			prim[k] = 0
			dvs[k] += 1
res = [n for n in range(1, x + 1) if dvs[n] == 1]
print(len(res))
print(*res)


import math

def is_prime(n):
	if n < 4:
		return True
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
n = int(input())
ans = []
for i in range(2, n + 1):
	if is_prime(i):
		p = i
		while p <= n:
			ans.append(p)
			p = p * i
print(len(ans))
for i in ans:
	print(i, end=' ')
print()


s = [1] * 1001
i = 2
while i * i < 1001:
	if s[i]:
		for j in range(i * i, 1001, i):
			s[j] = 0
	i += 1
x = int(input())
lol = []
for i in range(2, x + 1):
	if s[i]:
		k = i
		while k <= x:
			lol.append(k)
			k *= i
print(len(lol))
print(*lol)


def prime(n):
	prime = [1] * (n + 1)
	prime[0] = prime[1] = 0
	quest = []
	for i in range(2, n + 1):
		if prime[i] == 1:
			for c in range(i * i, n + 1, i):
				prime[c] = 0
		if prime[i] == 1:
			quest.append(i)
	return quest
n = int(input())
questions = prime(n)
if n == 1:
	print(len(questions))
else:
	e = 0
	i = 1
	num = questions[e]
	saida = []
	while e <= n:
		num *= i
		if num <= n:
			saida.append(num)
			i = questions[e]
		else:
			e += 1
			if len(questions) == e:
				break
			num = questions[e]
			i = 1
	print(len(saida))
	for j in saida:
		print(j, end=' ')


n = int(input())
not_need = []
upd = []
for i in range(2, n + 1):
	if i not in upd and i not in not_need:
		for elem in upd:
			if elem * i <= n and max(elem, i) % min(elem, i) != 0:
				not_need.append(elem * i)
		for elem in not_need:
			if elem * i <= n:
				not_need.append(elem * i)
		upd.append(i)
print(len(upd))
upd = [str(i) for i in upd]
print(' '.join(upd))


def Sieve(n):
	bools = [True for i in range(n + 1)]
	toReturn = []
	p = 2
	while p * p < n:
		if bools[p]:
			for i in range(p * 2, n + 1, p):
				bools[i] = False
		p += 1
	for i in range(2, n + 1):
		if bools[i]:
			toReturn.append(i)
	return toReturn

def Driver():
	n = int(input())
	primes = Sieve(n)
	for prime in primes:
		power = 1
		while prime ** power <= n:
			if power != 1:
				primes.append(prime ** power)
			power += 1
	print(len(set(primes)))
	print(' '.join((str(i) for i in set(primes))))
Driver()


import math
from decimal import *
import random

def sieve(n):
	mrk = [1] * (n + 1)
	(mrk[0], mrk[1]) = (0, 0)
	for i in range(2, int(math.sqrt(n)) + 2):
		if mrk[i]:
			for j in range(i * 2, n + 1, i):
				mrk[j] = 0
	ans = []
	for i in range(n + 1):
		if mrk[i]:
			ans.append(i)
	return ans
pfs = sieve(1000)
n = int(input())
pnt = 0
mult = 0
ans = []
for i in range(n):
	if pnt < len(pfs):
		val = int(pfs[pnt])
		while val <= n:
			ans.append(str(val))
			val *= pfs[pnt]
		pnt += 1
print(len(ans))
print(' '.join(ans))


from math import *

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
n = int(input())
ans = []
for i in range(2, n + 1):
	if isPrime(i) == 1:
		ans.append(i)
		k = i
		while k * i <= n:
			k *= i
			ans.append(k)
print(len(ans))
print(*ans)


import math, sys, bisect, heapq, os
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
from functools import lru_cache
int1 = lambda x: int(x) - 1

def input():
	return sys.stdin.readline().rstrip('\r\n')
aj = lambda : list(map(int, input().split()))

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])

def SieveOfEratosthenes(n):
	Z = []
	prime = [True for i in range(n + 1)]
	p = 2
	prime[0] = prime[1] = False
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
pri = SieveOfEratosthenes(10000)

def solve():
	(n,) = aj()
	if n == 1:
		print(0)
	else:
		Ans = []
		s = set()
		for i in range(2, n + 1):
			if pri[i]:
				Ans.append(i)
				s.add(i)
				r = i
				while r * i <= n:
					r *= i
					if not r in s:
						s.add(r)
						Ans.append(r)
		print(len(Ans))
		print(*Ans)
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
solve()


n = int(input())

def sieve():
	out = []
	aux = (n + 1) * [True]
	aux[0] = False
	aux[1] = False
	p = 2
	while p * p <= n:
		if aux[p]:
			for i in range(p * p, n + 1, p):
				aux[i] = False
		p += 1
	for p in range(n + 1):
		if aux[p]:
			i = p
			while i <= n:
				out.append(i)
				i *= p
	return out
out = sieve()
print(len(out))
print(' '.join([str(x) for x in out]))


def gen_prime():
	num = [0 for i in range(10 ** 3 + 1)]
	num[2] = 1
	num[3] = 1
	for i in range(4, 10 ** 3 + 1):
		isprime = True
		for j in range(2, int(i ** 0.5) + 1):
			if num[j]:
				if not i % j:
					isprime = False
					break
		if isprime:
			num[i] = 1
	prime = []
	for i in range(2, 10 ** 3 + 1):
		if num[i]:
			prime.append(i)
	return prime
n = int(input())
prime = gen_prime()
div = []
i = 0
while i < len(prime):
	for j in range(1, 10):
		if prime[i] ** j > n:
			break
		div.append(prime[i] ** j)
	i += 1
print(len(div))
for i in range(len(div)):
	print(div[i], end=' ')
print()


def main():
	n = int(input())
	dct = {}
	for i in range(2, n + 1):
		lst = checker(i)
		for j in lst:
			if j in dct:
				if lst[j] > dct[j]:
					dct[j] = lst[j]
			else:
				dct[j] = lst[j]
	res = ''
	k = 0
	for i in dct:
		for j in range(dct[i]):
			k += 1
			res += ' ' + str(i ** (j + 1))
	return str(k) + '\n' + res[1:]

def checker(n):
	res = {}
	while n > 1:
		for i in range(2, int(n) + 1):
			if n % i == 0:
				if i in res:
					res[i] += 1
				else:
					res[i] = 1
				n = n / i
				break
	return res
print(main())


n = int(input())
isc = [False] * (n + 1)
p = []
ans = []
for i in range(2, n + 1):
	if not isc[i]:
		p.append(i)
		j = i
		while j <= n:
			ans.append(j)
			j *= i
	for j in p:
		if i * j > n:
			break
		isc[i * j] = True
		if i % j == 0:
			break
print(len(ans))
print(*ans)


def prime(n):
	prime = [True] * (n + 1)
	i = 2
	while i <= n:
		for j in range(2 * i, n + 1, i):
			prime[j] = False
		i += 1
	return prime
n = int(input())
p = prime(n)
arr = []
for i in range(2, n + 1):
	if p[i]:
		for j in range(1, n + 1):
			k = pow(i, j)
			if k <= n:
				arr.append(k)
			else:
				break
print(len(arr))
for i in arr:
	print(i, end=' ')


n = int(input())
h = []
for i in range(2, n + 1):
	g = 0
	for j in range(2, int(i ** 0.5) + 1):
		if i % j == 0:
			g += 1
	if g == 0:
		h.append(i)
g = 0
while g < len(h):
	x = h[g]
	k = x * x
	while k <= n:
		if k not in h:
			h.append(k)
		k *= x
	g += 1
print(len(h))
print(*h)


import sys
import math
import itertools
import functools
import collections
import operator

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
n = ii()
ans = []
for i in range(n + 1):
	if prime(i):
		t = 1
		while i ** t <= n:
			ans.append(i ** t)
			t += 1
print(len(ans))
print(*ans)


import sys, math
input = sys.stdin.readline

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input().strip()

def listStr():
	return list(input().strip())
import collections as col
import math

def primes(n):
	sieve = [True] * n
	z = int(n ** 0.5) + 1
	for i in range(3, z, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]

def solve():
	N = getInt()
	if N == 1:
		print(0)
		return
	P = primes(N + 1)
	ans = []
	for p in P:
		power = 1
		while p ** power <= N:
			ans.append(p ** power)
			power += 1
	print(len(ans))
	print(*ans)
	return
solve()


n = int(input())
arr = []
for i in range(2, n + 1):
	isPrime = True
	for j in range(2, i):
		if i % j == 0:
			isPrime = False
			break
	if isPrime:
		c = 1
		while i ** c <= n:
			arr.append(str(i ** c))
			c += 1
print(len(arr))
print(' '.join(arr))


def sieve(n):
	primes = [1] * n
	for i in range(2, int(n ** 0.5) + 1):
		if primes[i] == 1:
			for j in range(2 * i, n, i):
				primes[j] = 0
	return primes
n = int(input())
arr = sieve(n + 2)
cnt = 0
ans = []
for i in range(2, len(arr)):
	if arr[i]:
		x = i
		while n // x > 0:
			ans.append(x)
			x *= i
print(len(ans))
print(*ans)


def prime_test(x):
	j = x
	for i in range(2, x):
		if j % i == 0:
			return False
	return True
n = int(input())
ans = 0
for i in range(2, n + 1):
	if prime_test(i) == True:
		j = i
		while j <= n:
			ans += 1
			j *= i
print(ans)
for i in range(2, n + 1):
	if prime_test(i) == True:
		j = i
		while j <= n:
			print(j)
			j *= i


n = int(input())
aux = [0] * (n + 1)
primes = []
for i in range(2, n + 1):
	if aux[i] == 0:
		primes.append(i)
		t = i
		for j in range(i, n + 1, i):
			aux[j] = 1
			if j / i == t:
				primes.append(j)
				t = j
print(len(primes))
print(' '.join(map(str, primes)))


def prog():
	n = int(input())
	primes = [True for i in range(n + 1)]
	for p in range(2, int(n ** 0.5) + 1):
		if primes[p]:
			for num in range(p ** 2, n + 1, p):
				primes[num] = False
	sequence = []
	for num in range(2, n + 1):
		if primes[num] == True:
			num_pow = num
			while num_pow <= n:
				sequence.append(str(num_pow))
				num_pow *= num
	print(len(sequence))
	print(' '.join(sequence))
prog()


from collections import Counter

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	for p in range(n + 1):
		if prime[p]:
			yield p

def main():
	n = int(input())
	asked = []
	for p in sieve(n):
		i = 1
		pp = p ** i
		while pp <= n:
			asked.append(pp)
			i += 1
			pp = p ** i
	print(len(asked))
	print(*asked)
main()


n = int(input())
MAX = 1001
bs = [True] * MAX
primes = []

def sieve():
	bs[0] = False
	bs[1] = False
	for i in range(2, MAX):
		if bs[i]:
			for j in range(i * i, MAX, i):
				bs[j] = False
			primes.append(i)

def num_pfs(number):
	pfs = set()
	for p in primes:
		if p * p > number:
			break
		if number % p == 0:
			pfs.add(p)
			while number % p == 0:
				number //= p
	if number != 1:
		pfs.add(number)
	return len(pfs)
q = []
sieve()
for i in range(2, n + 1):
	if bs[i] or num_pfs(i) == 1:
		q.append(i)
print(len(q))
print(' '.join(map(str, q)))


from math import sqrt, pow, log, log2, log10, exp
from copy import deepcopy

def read_ints():
	return list(map(int, input().split()))

def read_int():
	return read_ints()[0]

def read_floats():
	return list(map(float, input().split()))

def read_float():
	return read_floats()[0]

def one_dim_array(value, n):
	return [deepcopy(value) for x in range(n)]

def two_dim_array(value, n, m):
	return [[deepcopy(value) for x in range(m)] for x in range(n)]

def is_prime(n):
	if n == 2:
		return True
	if n % 2 == 0:
		return False
	for i in range(3, int(sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def tf_to_yn(b):
	return 'YES' if b else 'NO'
n = read_int()
res = []
for x in range(2, n + 1):
	if is_prime(x):
		e = x
		while e <= n:
			res.append(e)
			e *= x
print(len(res))
print(' '.join(map(str, res)))


def crivo(n):
	prime = [True for x in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	resp = []
	for i in range(2, n + 1):
		if prime[i]:
			resp.append(i)
	return resp
n = int(input())
aux = 2
resp = []
for e in crivo(n):
	i = 1
	while e ** i <= n:
		resp.append(e ** i)
		i += 1
print(len(resp))
for e in resp:
	print(e, end=' ')


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]

def prime(n):
	pr = [True] * (n + 1)
	pr[1] = False
	p = 2
	while p * p <= n:
		if pr[p] == True:
			for j in range(p * p, n + 1, p):
				pr[j] = False
		p += 1
	return [i for i in range(2, len(pr)) if pr[i]]
primes = prime(3000)
n = Int()
ind = bisect_right(primes, n)
ans = []
for i in range(ind + 1):
	k = 1
	while primes[i] ** k <= n:
		ans.append(primes[i] ** k)
		k += 1
print(len(ans))
print(*ans)


def prime(n):
	i = 2
	f = True
	while i * i <= n:
		if n % i == 0 and f:
			f = False
		i += 1
	return f

def all_prime(n):
	result = []
	for i in range(2, n + 1):
		if prime(i):
			result.append(i)
	return result
n = int(input())
array = all_prime(n)
answer = []
for i in array:
	t = 1
	while i ** t <= n:
		answer.append(i ** t)
		t += 1
if len(answer) == 0:
	print(0)
else:
	print(len(answer))
	print(*answer)


ls = [True] * 1004
n = int(input())
primes = []
for i in range(2, n + 1):
	if ls[i]:
		primes.append(i)
		for j in range(2 * i, n + 1, i):
			ls[j] = False
lst = []
for prime in primes:
	p = prime
	while p <= n:
		lst.append(p)
		p *= prime
print(len(lst))
for el in lst:
	print(el, end=' ')


n = int(input())
prime = [True] * (n + 2)
prime[0] = False
prime[1] = False
pr = []
for i in range(2, n + 1):
	if prime[i]:
		pr.append(i)
		for j in range(2 * i, n + 1, i):
			prime[j] = False
ch = []
for p in pr:
	j = 1
	while p ** j <= n:
		ch.append(p ** j)
		j += 1
print(len(ch))
print(*ch)


import os
import sys
from io import BytesIO, IOBase
import math
from decimal import Decimal
from decimal import *
from collections import defaultdict, deque
import heapq
from decimal import Decimal
getcontext().prec = 25
abcd = 'abcdefghijklmnopqrstuvwxyz'
MOD = pow(10, 9) + 7
BUFSIZE = 8192
from bisect import bisect_left, bisect_right

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def sieve_of_eratosthenes(n):
	all_prime = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n):
		if prime[p]:
			all_prime.append(p)
	return all_prime
l = set(sieve_of_eratosthenes(1001))
dp = [0] * 1001
for i in l:
	a = i
	while a < 1001:
		dp[a] = 1
		a *= i
n = int(input())
ans = []
for i in range(n + 1):
	if dp[i]:
		ans.append(i)
print(len(ans))
print(*ans)


from heapq import heapify, heappush, heappop
from collections import Counter, defaultdict, deque, OrderedDict
from sys import setrecursionlimit, maxsize
from bisect import bisect_left, bisect, insort_left, insort
from math import ceil, log, factorial, hypot, pi
from fractions import gcd
from copy import deepcopy
from functools import reduce
from operator import mul
from itertools import product, permutations, combinations, accumulate, cycle
from string import ascii_uppercase, ascii_lowercase, ascii_letters, digits, hexdigits, octdigits
prod = lambda l: reduce(mul, l)
prodmod = lambda l, mod: reduce(lambda x, y: mul(x, y) % mod, l)
argmax = lambda l: l.index(max(l))
argmin = lambda l: l.index(min(l))

def read_list(t):
	return [t(x) for x in input().split()]

def read_line(t):
	return t(input())

def read_lines(t, N):
	return [t(input()) for _ in range(N)]

class Prime:

	def __init__(self, n):
		self.is_prime = [True for _ in range(n + 1)]
		self.primeList = []
		self.is_prime[0] = self.is_prime[1] = False
		for i in range(2, int(pow(n, 0.5)) + 1):
			if self.is_prime[i] == True:
				self.primeList.append(i)
				for j in range(2 * i, n + 1, i):
					self.is_prime[j] = False
		for i in range(int(pow(n, 0.5)) + 1, n + 1):
			if self.is_prime[i] == True:
				self.primeList.append(i)

	def isPrime(self, n):
		return self.is_prime[n]

	def nthPrime(self, n):
		return self.primeList[n - 1]
N = read_line(int)
p = Prime(N)
ans = []
for i in range(2, N + 1):
	if p.isPrime(i):
		now = i
		while now <= N:
			ans.append(now)
			now *= i
print(len(ans))
if len(ans) > 0:
	print(*ans)


def isPrime(i):
	if i == 2:
		return True
	for k in range(2, i):
		if i % k == 0:
			return False
	return True
n = int(input())
cnt = 0
ans = []
if n == 1:
	print(0)
	print('')
else:
	for i in range(2, n + 1):
		if isPrime(i):
			k = i
			while k <= n:
				cnt += 1
				ans.append(k)
				k = k * i
	print(cnt)
	print(' '.join(map(str, ans)))


import sys
readline = sys.stdin.readline

def prsh(N):
	prime = [2]
	for L in range(3, N):
		for p in prime:
			if not L % p:
				break
			if p > L ** (1 / 2):
				prime.append(L)
				break
	return prime
N = int(readline())
prime = prsh(N + 1)
table = [0] * (N + 1)
for p in prime:
	for i in range(1, N):
		if pow(p, i) > N:
			break
		table[pow(p, i)] = 1
ans = sum(table)
Ans = [i for i in range(N + 1) if table[i]]
print(ans)
print(*Ans)


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p + p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def solve():
	a = sieve(10 ** 3)
	for i in range(2, 10):
		p = i
		if a[p]:
			while p < len(a) + 1:
				a[p] = True
				p *= i
	n = int(input())
	c = 0
	y = []
	for i in range(2, n + 1):
		if a[i]:
			y.append(i)
	print(len(y))
	print(*y)
for _ in range(1):
	solve()


import sys
import collections
from collections import Counter
import itertools
import math
import timeit

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
n = ii()
p = sieve(n)
res = []
for i in p:
	t = i
	while t <= n:
		res.append(t)
		t *= i
print(len(res))
prr(res)


def splt(a):
	answer = []
	for i in range(2, a + 1):
		if a % i == 0:
			while a % i == 0:
				answer.append(i)
				a = a / i
		if a == 1:
			break
	return answer

def main():
	n = int(input())
	sets = []
	ans = []
	for a in range(2, n + 1):
		spl = splt(a)
		enuf = 1
		for b in spl:
			if spl.count(b) > sets.count(b):
				enuf = 0
				for c in range(spl.count(b) - sets.count(b)):
					sets.append(b)
		if enuf == 0:
			ans.append(str(a))
	print(len(ans))
	print(' '.join(ans))
main()


n = int(input())
ans = []
used = [False] * (n + 1)
for p in range(2, n + 1):
	q = p
	while q <= n:
		if not used[q]:
			used[q] = True
			ans.append(q)
		q *= p
	for i in range(p, n + 1, p):
		used[i] = True
print(len(ans), '\n', ' '.join(map(str, ans)))


def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num
primes = SieveOfEratosthenes(1001)
n = int(input())
ask = []
for i in primes:
	if i <= n:
		j = 1
		while i ** j <= n:
			ask.append(i ** j)
			j += 1
print(len(ask))
print(*ask)


n = int(input())
s = set([i for i in range(2, n + 1)])
for i in range(2, n + 1):
	if i in s:
		for j in range(i * 2, n + 1, i):
			if j in s:
				s.remove(j)
subs = set()
for i in s:
	p = i * i
	while p <= n:
		subs.add(p)
		p *= i
print(len(s) + len(subs))
print(' '.join(map(str, s)), ' '.join(map(str, subs)))


def crivo_Eratostenes(maiorValor):
	lista = [True] * maiorValor
	i = 2
	while i < maiorValor:
		if lista[i] == True:
			j = i * i
			while j < maiorValor:
				lista[j] = False
				j += i
		i += 1
	return lista
maiorValor = 1001
ehPrimo = crivo_Eratostenes(maiorValor)
num = int(input())
resultado = []
i = 2
while i <= num:
	if ehPrimo[i]:
		j = 1
		while i ** j <= num:
			resultado.append(i ** j)
			j += 1
	i += 1
print(len(resultado))
print(*resultado)