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

#SP0000189. Các số có đúng chín ước (9 Divisors)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Các số có đúng chín ước (9 Divisors)

9 Divisors

Source: AtCoder ABC383 D — https://atcoder.jp/contests/abc383/tasks/abc383_d
Edition: Phuoc Hung OJ Extended; one dataset per program run. Subtasks are authored for PHOJ, not claimed to be official.

Problem

Count positive integers m≤Nm\le N with exactly nine positive divisors. Each valid number is either p8p^8 or p2q2p^2q^2 for distinct primes p<qp<q.

Input

One integer NN.

Output

Print the number of integers with exactly nine divisors.

Subtasks

  • Subtask 1 (20 points): 1≤N≤1061\le N\le10^6.
  • Subtask 2 (30 points): 1≤N≤10101\le N\le10^{10}.
  • Subtask 3 (50 points): 1≤N≤4⋅10121\le N\le4\cdot10^{12}.

Example

Input

200

Output

3

Explanation

Exactly 3636, 100100, and 196196 have nine divisors among positive integers not greater than 200200.