#include<stdio.h>
#include<math.h>
int main() {
    int n = 0;
    int count = 0;
    while (scanf("%d", &n) != EOF) {
        int i, j = 0;
        for (i = 2; i <=n; i++) {
            for (j = 2; j <sqrt(i); j+=1) {
                if (i % j == 0)
                    break;
            }
            if (j>sqrt(i)) {
                printf("%d ", i);
                count++;
            }
        }
    }
printf("\n");
    printf("%d",n-count-1);  //这边我也不懂哎
}