while 1: try: n = int(input()) list = [i for i in range(2,n+1)] zero = 0 for j in list: for k in list[j-1:]: if k % j == 0: list.remove(k) zero += 1 for l in list: print(l,end=' ') print('') print(zero) except: break