import math
# Input: an integer n > 1.
N = int(input("N: "))
# Let A be an array of Boolean values, indexed by integers 2 to n, initially all set to true.
A = list(range(2, N))
# for i = 2, 3, 4, ..., not exceeding √n:
for i in range(2, int(math.sqrt(N)+1)):
# if A[i] is true:
if i in A:
# for j = i2, i2+i, i2+2i, i2+3i, ..., not exceeding n:
for j in range(i**2, N, i):
# A[j] := false.
if j in A: A.remove(j)
# Output: all i such that A[i] is true.
print(A)
aW1wb3J0IG1hdGgKCiMgSW5wdXQ6IGFuIGludGVnZXIgbiA+IDEuCk4gPSBpbnQoaW5wdXQoIk46ICIpKQoKIyBMZXQgQSBiZSBhbiBhcnJheSBvZiBCb29sZWFuIHZhbHVlcywgaW5kZXhlZCBieSBpbnRlZ2VycyAyIHRvIG4sIGluaXRpYWxseSBhbGwgc2V0IHRvIHRydWUuCkEgPSBsaXN0KHJhbmdlKDIsIE4pKQoKIyBmb3IgaSA9IDIsIDMsIDQsIC4uLiwgbm90IGV4Y2VlZGluZyDiiJpuOgpmb3IgaSBpbiByYW5nZSgyLCBpbnQobWF0aC5zcXJ0KE4pKzEpKToKICAKICAjIGlmIEFbaV0gaXMgdHJ1ZToKICBpZiBpIGluIEE6CiAgICAKICAgICMgZm9yIGogPSBpMiwgaTIraSwgaTIrMmksIGkyKzNpLCAuLi4sIG5vdCBleGNlZWRpbmcgbjoKICAgIGZvciBqIGluIHJhbmdlKGkqKjIsIE4sIGkpOgogICAgICAKICAgICAgIyBBW2pdIDo9IGZhbHNlLgogICAgICBpZiBqIGluIEE6IEEucmVtb3ZlKGopCgojIE91dHB1dDogYWxsIGkgc3VjaCB0aGF0IEFbaV0gaXMgdHJ1ZS4gICAgICAgIApwcmludChBKQ==