Mancunian, our favourite football fan, is a die-hard supporter of Manchester United Football Club. Being so, he is desperate to attend the grand unveiling of Jose Mourinho as the next manager of the club. But, his arch-nemesis Liverbird (who is a Liverpool fan) wants him to fail. Knowing that Mancunian is weak at mathematics, he has given him a problem to solve before the ceremony. Can you help Mancunian do it and thwart the evil plans of Liverbird?
A is one whose number of distinct prime factors is equal to the number of digits in its decimal representation. The number 1 is considered a naughty number.
Given Q queries, each query specifying two integers a and b, find the number of lying between a and b (both included).
The first line contains an integer Q denoting the number of queries.
Each of the next Q lines consists of two integers a and b denoting the range for this query.
Print Q lines. The line contains the answer for the query.
In the range 1-, all numbers except 6 are naughty numbers.
In the range -, the naughty numbers are , , and .
In the range -, only and are naughty numbers.