import java.util.Scanner;
import java.util.Arrays;
class Main
{
public static final int N = 10000;
public static boolean[] vis;
public static void sieve()
{
vis = new boolean[N];
Arrays.fill(vis, true);
vis[0] = vis[1] = false;
for (int i = 2; i < 100; i++) {
if (vis[i]) {
for (int j = i * i; j < N; j += i) vis[j] = false;
}
}
}
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
int n;
sieve();
while (cin.hasNext()) {
n = cin.nextInt();
boolean first = true;
for (int i = 2; i < n; i++) {
if (vis[i] && i % 10 == 1) {
if (first) first = false;
else System.out.print(" ");
System.out.print(i);
}
}
if (first) System.out.print(-1);
System.out.println();
}
}
}