/**
 * Author: Sergey Kopeliovich (Burunduk30@gmail.com5
 * Date: 2013.10.05
 *
 * Status: Accepted, Time = 0.7
 */

import java.util.*;
import java.io.*;

public class fourprimes_sk {
	final int N = (int)1e5;
	final int PN = (int)2e4;

	int n, pn, p[] = new int[PN], c[] = new int[2 * N];
	boolean is[] = new boolean[N];

	StreamTokenizer in;
	PrintWriter out;
	
	int nextInt() throws IOException {
		in.nextToken();
		return (int)in.nval;
	}

	public void run() throws IOException {
		final String NAME = "fourprimes";
		in = new StreamTokenizer(new BufferedReader(new FileReader(NAME + ".in")));
		PrintWriter out = new PrintWriter(new File(NAME + ".out"));

		int n = nextInt();
		for (int i = 2; i < n; i++) {
			if (!is[i]) {
				p[pn++] = i;
				for (int j = i + i; j < n; j += i) {
					is[j] = true;
				}
			}
		}

		for (int i = 0; i < pn; i++) {
			for (int j = 0; j < pn; j++) {
				c[p[i] + p[j]]++;
			}
		}

		long cnt = 0;
		for (int i = 0; i < n; i++) {
			cnt += (long)c[i] * c[n - i];
		}
		out.println(cnt);
		out.close();
	}

	static public void main(String[] args) throws Exception {
		new fourprimes_sk().run();
	}
}
