#include #include #include #include #include #define rep(i,a) for(int i=0;i=0;i--) #define ll long long #define INF 11451419191810 using namespace std; int main(){ ll n; cin >> n; vector prime(n + 1,true); prime[0] = false; prime[1] = false; ll index = 2; while (index*index <= n){ if (prime[index]){ ll j = index + index; while (j <= n){ prime[j] = false; j += index; } }index++; }ll count = 0; vector p; rep(i, n + 1) if (prime[i]) p.push_back(i); vector dp(n + 1, -1); dp[0] = 0; for (ll i : p){ mrep(j, n){ if (i + j <= n && dp[j] != -1){ dp[i + j] = max(dp[i + j], dp[j] + 1); } } }cout << dp[n] << endl; return 0; }