#include #include #include #include using namespace std; int N,M; int i1[20010]={0}; int dp[7500][20010]={0}; int i,j,k,c=0; int main(void){ cin>>N; i1[c]=2; c++; for(i=3;i<=N;i+=2){ k=0; for(j=3;j<=sqrt(i);j+=2) { if(i%j==0) { k=1; break; } } if(k==0){ i1[c]=i; c++; } } for(j=0;j0||i1[j]==i){ dp[j+1][i]=max(dp[j][i],dp[j][i-i1[j]]+1); } else{dp[j+1][i]=dp[j][i];} } } if(dp[c][N]==0){cout<<-1<