import java.util.Scanner;
public class Main {
    
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()) {
            int n = sc.nextInt();    // 每行输入的整数n
            int[] arr = new int[n];
            boolean isLing = false;
            int index = 0;
            for(int i = 2 ; i < n ; i++) {
                for(int j = 2 ; j < i ; j++) {
                    if(i % j == 0) {
                        isLing = true;
                        break;
                    } else {
                        isLing = false;
                    }
                }
                if(!isLing) {
                    arr[index++] = i;
                }
            }
            int count = 0;
            for(int i = 0 ; i < n ; i++) {
                if(arr[i] != 0) {
                    count++;
                    System.out.print(arr[i] + " ");
                }
            }
            System.out.println();
            System.out.println(n - 1 - count);
        }
        
    }
}