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

#SP0000071. Số gần nguyên tố (Almost Prime)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Số gần nguyên tố (Almost Prime)

Almost Prime

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

A positive integer is almost prime if it has exactly two distinct prime divisors. For example, 6=2⋅36=2\cdot3 and 18=2⋅3218=2\cdot3^2 each have the distinct prime divisors 2,32,3, whereas 4=224=2^2 has one and 42=2⋅3⋅742=2\cdot3\cdot7 has three. Given nn, count all almost prime integers in [1,n][1,n].

Input

One line contains the integer nn.

Output

Print how many almost prime integers are in [1,n][1,n].

Subtasks

  • Subtask 1 (20 points): 1≤n≤601\le n\le 60.
  • Subtask 2 (30 points): 1≤n≤5001\le n\le 500.
  • Subtask 3 (50 points): 1≤n≤30001\le n\le 3000.

Examples

Input

10

Output

2

Explanation

In [1,10][1,10], the integer 66 has prime divisors 2,32,3 and 1010 has prime divisors 2,52,5. The numbers 4,8,94,8,9 each have only one distinct prime divisor, and no other number has exactly two. Hence the answer is 22.