import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] array=new int[n];
        int clear=1;
        for(int i=2;i<n;i++) //2 3 5 7
        {
            array[i]=i;
            if(i>2&&array[i]%2==0)
            {
                array[i]=0;
                clear++;
            }else if(i>3&&array[i]%3==0)
            {
                array[i]=0;
                clear++;
            }else if(i>5&&array[i]%5==0)
            {
                array[i]=0;
                clear++;
            }else if(i>7&&array[i]%7==0)
            {
                array[i]=0;
                clear++;
            }
        }
        for(int i=2;i<n;i++)
        {
            if(array[i]!=0)
            {
                System.out.print(array[i]+" ");
            }
        }
        System.out.println();
        System.out.println(clear);
    }
}