import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); ArrayList prime = new ArrayList(); for(int i = 2; i <= N; i++) { boolean flg = true; for(int j = 2; j * j <= i; j++) { if(i % j == 0) { flg = false; break; } } if(flg) prime.add(i); } int num = prime.size(); // dp[i][j]はiを異なる素数の和で表す(最大の素数をprime.get(j)とする)場合の、最大の和の回数を表す int[][] dp = new int[N + 1][num]; // sum[i][j] = dp[i][0] +...+dp[i][j] int[][] sum = new int[N + 1][num]; dp[2][0] = 1; for(int j = 0; j < num; j++) { sum[2][j] = 1; } for(int i = 3; i < N + 1; i++) { for(int j = 1; j < num; j++) { if(i >= prime.get(j)) dp[i][j] = sum[i - prime.get(j)][j]; sum[i][j] = sum[i][j - 1] + dp[i][j]; } } int ans = -1; if(sum[N][num - 1] > 0) ans = sum[N][num - 1]; System.out.println(ans); } }