import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { long curtime=System.currentTimeMillis(); new Main().run(); System.err.println(System.currentTimeMillis()-curtime); } int MAX=300001; boolean[] isPrime=new boolean[MAX]; ArrayList primes=new ArrayList<>(); { Arrays.fill(isPrime, true); isPrime[0]=isPrime[1]=false; for(int i=2;iN)break; for(int q:primes) { if(q>N)break; ++dp[p+q]; } } long ans=0; int src=0; for(int p:primes) { if(p>N)break; while(srcN)break; for(int q:primes) { if(q>N)break; if(isPrime[p+p+q]) { ans-=3; } } } if(ans%6!=0)throw new AssertionError(); System.out.println(ans/6); } void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));} }