import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int[] arr = new int[n - 1];
            int count = 0; // 清除掉的个数
            // 将2~n之间的正整数放在数组内存储
            for (int i = 2; i <= n; i++) {
                arr[i - 2] = i;
            }

            for (int i = 0; i < arr.length; i++) {
                // 第一次循环是对2以后的数做2整除
                // 第二次循环是对3以后的数做3整除
                for (int j = i + 1; j < arr.length; j++) {
                    if (arr[j] % (i + 2) == 0 && arr[j] != 0) {
                        arr[j] = 0;
                    }
                }
            }
            // 输出不等于0的数
            for (int i = 0; i < arr.length; i++) {
                if (arr[i] != 0) {
                    System.out.print(arr[i] + " ");
                } else {
                    count++;
                }
            }
            System.out.println();
            System.out.print(count);
        }
    }
}