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

#SP0000113. Nguyên tố theo số thừa số nguyên tố (Prime-Factor Prime)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Nguyên tố theo số thừa số nguyên tố (Prime-Factor Prime)

Prime-Factor Prime

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Factor each positive integer xx into primes, counting repeated factors. Let Ω(x)\Omega(x) be the total number of prime factors with multiplicity; for instance 12=2⋅2⋅312=2\cdot2\cdot3 has Ω(12)=3\Omega(12)=3, while Ω(1)=0\Omega(1)=0. An integer is prime-factor prime if Ω(x)\Omega(x) is itself prime. Count such integers in the closed interval [l,r][l,r].

Input

One line contains integers l,rl,r.

Output

Print one integer: the number of x∈[l,r]x\in[l,r] for which Ω(x)\Omega(x) is prime.

Subtasks

  • Subtask 1 (20 points): 1≤l≤r≤100001\le l\le r\le 10000; 1≤r−l+1≤5001\le r-l+1\le 500.
  • Subtask 2 (30 points): 1≤l≤r≤100000001\le l\le r\le 10000000; 1≤r−l+1≤500001\le r-l+1\le 50000.
  • Subtask 3 (50 points): 1≤l≤r≤10000000001\le l\le r\le 1000000000; 1≤r−l+1≤10000001\le r-l+1\le 1000000.

Examples

Input

1 9

Output

4

Explanation

The four qualifying numbers in [1,9][1,9] are 4=2⋅24=2\cdot2 (two factors), 6=2⋅36=2\cdot3 (two), 8=2⋅2⋅28=2\cdot2\cdot2 (three), and 9=3⋅39=3\cdot3 (two). Because 22 and 33 are prime, print 44.