PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000126. Đếm cách biểu diễn Goldbach (Goldbach's Conjecture (II))

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đếm cách biểu diễn Goldbach (Goldbach's Conjecture (II))

Goldbach's Conjecture (II)

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

For an even integer n≥4n\ge4, count representations n=a+bn=a+b where a,ba,b are prime. Pairs (a,b)(a,b) and (b,a)(b,a) represent the same way, so count only pairs with a≤ba\le b. The pair (p,p)(p,p) is allowed.

Input

One line containing the integer nn.

Output

Print one integer: the number of qualifying pairs.

Subtasks

  • Subtask 1 (20 points): 4≤n≤1004\le n\le 100; nn is even.
  • Subtask 2 (30 points): 4≤n≤10004\le n\le 1000; nn is even.
  • Subtask 3 (50 points): 4≤n≤327664\le n\le 32766; nn is even.

Examples

Input

10

Output

2

Explanation

For n=10n=10, consider a≤5a\le5. a=2a=2 gives composite b=8b=8; a=3a=3 gives the prime pair (3,7)(3,7); a=5a=5 gives (5,5)(5,5). There are exactly two valid pairs, so print 2.