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

#SP0000185. AABCC — tích ba số nguyên tố

HỌC THEO LỘ TRÌNH

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

1 lộ trình

AABCC — tích ba số nguyên tố

AABCC

Phuoc Hung OJ ID: PRIME000190
Source: AtCoder ABC300 D (PHOJ Extended, one input instance per run).

Problem statement

Given an integer NN, count positive integers x≤Nx\le N that can be expressed as x=a2bc2x=a^2bc^2, where a<b<ca<b<c are three prime numbers.

Input

One integer NN.

Output

Print the number of qualifying integers.

Subtasks

  • Subtask 1 (20 points): 300≤N≤105300\le N\le10^5.
  • Subtask 2 (30 points): 105<N≤10810^5<N\le10^8.
  • Subtask 3 (50 points): 108<N≤101210^8<N\le10^{12}.

Example

Input

1000

Output

3

Explanation: The three qualifying integers are 300 = 2^2 x 3 x 5^2, 588 = 2^2 x 3 x 7^2 and 980 = 2^2 x 5 x 7^2.