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

#SP0000060. Sàng của Alice (Alice Sieve)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Sàng của Alice (Alice Sieve)

Alice Sieve

Source: SPOJ

Version: Phuoc Hung OJ Extended

Problem Statement

Alice writes the integers from NN down to 22, initially all unmarked. She chooses the largest unmarked number as PP (initially NN) and marks every proper positive divisor of PP present in the list, excluding PP itself. She then chooses the largest unmarked number smaller than PP and repeats. The process ends when no next number can be selected. Count the integers in [2,N][2,N] that remain unmarked.

Input

One line contains integer NN.

Output

Print one integer: how many numbers remain unmarked after the process finishes.

Subtasks

  • Subtask 1 (20 points): 2≤N≤502\le N\le 50.
  • Subtask 2 (30 points): 2≤N≤50002\le N\le 5000.
  • Subtask 3 (50 points): 2≤N≤10000002\le N\le 1000000.

Examples

Input

5

Output

3

Explanation

Initially the list is 5,4,3,25,4,3,2. For P=5P=5, no proper divisor lies in [2,5][2,5]. Next P=4P=4 marks 22, its proper divisor. Then P=3P=3 marks nothing further. The unmarked numbers are 3,4,53,4,5, giving the answer 3.