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

#SP0000183. Lona và số nguyên tố

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Lona và số nguyên tố

Lona and Prime Numbers

Source: VNOJ bedao_r17_b
Version: Phuoc Hung OJ Extended (one dataset per execution; batched queries remain together).

Problem Statement

Given a positive integer nn, count integers s≤ns\le n of the form s=p3q3s=p^3q^3 for distinct primes p,qp,q. Swapping pp and qq does not create a different ss.

Input

One positive integer nn.

Output

Print the number of valid integers ss.

Subtasks

  • Subtask 1 (50 points): 1≤n≤1061\le n\le10^6.
  • Subtask 2 (50 points): 1≤n≤10181\le n\le10^{18}.

Sample Input

1000

Sample Output

2

Sample Explanation

The valid integers are 216=23⋅33216=2^3\cdot3^3 and 1000=23⋅531000=2^3\cdot5^3.