#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
using namespace std;
int nc;
int n[46000005];
int a[40000001];
int aj;
int main()
{
freopen("sssxmoban.in","r",stdin);
freopen("sssxmoban.out","w",stdout);
scanf("%d",&nc);
printf("%d\n",nc);
for(ll i=2;i<=nc;i++)
{
if(!n[i])
{
printf("%d ",i);
n[i]=i;
a[++aj]=i;
}
for(int o=1;a[o]<=n[i]&&a[o]*i<=nc&&o<=aj;o++) n[a[o]*i]=a[o];
}
// printf("\n");
return 0;
}