import math

def getprimenum():
    list1=[]
    list1.append(1)
    list1.append(2)
    for i in range(2,100001):
        flag = 0
        for j in range(2,math.ceil(math.sqrt(float(i)))+1):
            if i%j==0:
                flag=1
                break
        if flag==0:
            list1.append(i)
    return list1
list2=getprimenum()

while True:
    try:
        num=int(input())
        i=0
        num1=0
        flag=0
        while list2[i]<num:
            i+=1
        num1=i
        for i in range(1,num1):
            if list2[i]%10==1:
                flag=1
                print(list2[i],end=' ')
        if flag==0:
            print(-1)
    except EOFError:
        break