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

#SP0000279. Các số có đúng bốn ước (Four 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 bốn ước (Four Divisors)

Four Divisors

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

A positive integer dd is a positive divisor of a positive integer xx if dd divides xx. For example, 1212 has six positive divisors: 1,2,3,4,6,121,2,3,4,6,12.

Let D(N)D(N) be the number of integers xx between 11 and NN, inclusive, that have exactly four distinct positive divisors. Given NN, compute D(N)D(N).

Input

The only line contains a positive integer NN.

Output

Print one integer: D(N)D(N).

Subtasks

  • Subtask 1 (20 points): 1≤N≤1000001\le N\le 100000. Time limit: 55 s.
  • Subtask 2 (30 points): 1≤N≤1000000001\le N\le 100000000. Time limit: 1010 s.
  • Subtask 3 (50 points): 1≤N≤1000000000001\le N\le 100000000000. Time limit: 2020 s.

Examples

Example 1

Input

10

Output

3

Explanation

Exactly three numbers qualify: 66 with divisors 1,2,3,61,2,3,6; 88 with 1,2,4,81,2,4,8; and 1010 with 1,2,5,101,2,5,10. Thus D(10)=3D(10)=3.

Example 2

Input

20

Output

5

Explanation

The qualifying numbers in [1,20][1,20] are 6,8,10,14,156,8,10,14,15. For instance, the divisors of 1515 are 1,3,5,151,3,5,15. There are five qualifying integers.

Example 3

Input

30

Output

9

Explanation

The nine qualifying integers in [1,30][1,30] are 6,8,10,14,15,21,22,26,276,8,10,14,15,21,22,26,27. Therefore print 9.