#define ll long long #define rep(i,l,r)for(ll i=(l);i<(r);i++) int isp(ll n){ for(ll i=2;i*i<=n;i++)if(n%i==0)return 0; return 1; } ll a[2][50]; maekeisann(){ a[0][0]=1; a[1][0]=2; ll cnt=1; for(ll c=3;c<1000;c++)if(isp(c+c+1)){ int f=1; rep(i,0,cnt)if(isp(c+ a[ c%2][i]))f=0; rep(i,0,cnt)if(isp(c+1+a[1-c%2][i]))f=0; if(f){ a[0][cnt]=c%2?c:c+1; a[1][cnt]=c%2?c+1:c; cnt++; } } } ll ans[50],len,n; f(ll k){ if(k==0)return 0; ll temp=sqrt(k); k-=temp*temp; ans[len++]=temp; n+=temp; f(k); } main(){ maekeisann(); ll k; scanf("%lld",&k); f(k); printf("%d\n",n*2); rep(i,0,len)rep(j,0,ans[i])printf("%lld %lld ",a[0][i],a[1][i]); }