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

#SP0000141. Bộ ba nguyên tố cùng nhau của Dora (Dora's Set)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Bộ ba nguyên tố cùng nhau của Dora (Dora's Set)

Dora's Set

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Initially the set SS contains every integer in the interval [l,r][l,r]. In one operation, select three distinct remaining integers a,b,ca,b,c that are pairwise coprime:

gcd⁡(a,b)=gcd⁡(b,c)=gcd⁡(a,c)=1.\gcd(a,b)=\gcd(b,c)=\gcd(a,c)=1.

Remove all three selected integers from SS. Find the maximum number of operations.

Input

One line contains integers l,rl,r.

Output

Print the maximum number of operations.

Subtasks

  • Subtask 1 (20 points): 1≤l≤r≤301\le l\le r\le30.
  • Subtask 2 (30 points): 1≤l≤r≤3001\le l\le r\le300.
  • Subtask 3 (50 points): 1≤l≤r≤10001\le l\le r\le1000.

Examples

Input

10 21

Output

3

Explanation

The interval [10,21][10,21] contains six odd integers: 11,13,15,17,19,2111,13,15,17,19,21. Three operations are possible using {11,12,13}\{11,12,13\}, {15,16,17}\{15,16,17\}, and {19,20,21}\{19,20,21\}. Each triple is pairwise coprime. Every operation needs at least two odd numbers, so six odds allow at most three operations. The answer is 3.