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

#SP0000132. Đếm tổng tiền tố nguyên tố (Consecutive Prime Sum)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Đếm tổng tiền tố nguyên tố (Consecutive Prime Sum)

Consecutive Prime Sum

Source: CodeChef — CONSPRIMESUM

Version: Phước Hưng OJ Extended; one input file per judge run.

Problem Statement

Consider prefix sums of the increasing sequence of primes 2,3,5,7,…2,3,5,7,\ldots, using at least two terms. Given NN, count prime-valued prefix sums not exceeding NN. The original multiple-case format is adapted to one NN per run.

Input

One integer NN.

Output

Print the count of qualifying prime prefix sums.

Subtask

  • Subtask 1 (20 points): 2≤N≤1002\le N\le100.
  • Subtask 2 (30 points): 2≤N≤100002\le N\le10000.
  • Subtask 3 (50 points): 2≤N≤1000002\le N\le100000.

Example

Input

50

Output

3

Explanation

The example follows the mathematical conditions and the specified output format.