import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            int n = sc.nextInt();
            int[] v = new int[n + 1];
            for(int i = 0; i <= n; ++i) v[i] = i;
            v[1] = 0;
            int c = 1;
            for(int i = 0; i <= n; ++i){
                if(v[i] != 0){
                    System.out.printf("%d ", v[i]);
                    c++;
                    for(int j = 2; j*v[i] <= n; ++j){
                        v[j*v[i]] = 0;
                    }
                }
            }
            System.out.println();
            System.out.println(n - c);
        }
    }
}