{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eAccording to Sheldon Cooper, the best number is 73. In his own words,\n\u003ci\u003e“The best number is 73. 73 is the 21st prime number. Its mirror, 37,\nis the 12th, and its mirror, 21, is the product of multiplying 7 and 3.\nIn binary, 73 is a palindrome: 1001001, which backwards is 1001001.\nExactly the same.”\u003c/i\u003e\u003c/p\u003e\n\n\u003cp\u003ePrime numbers are boring stuff, and so are palindromes. On the other\nhand, the binary representation of $73$ is rather remarkable: it’s $1$ one\nfollowed by $2$ zeroes, followed by $1$ one, followed by $2$ zeros, followed\nby $1$ one. This is an interesting pattern that we can generalize: $N$ ones, followed by $M$\nzeros, followed by $N$ ones, followed by $M$ zeros, etc, ending in either $N$ ones or $M$ zeroes.\nFor $73$, $N$ is $1$, $M$ is $2$, and there are $5$ runs of equal symbols. With $N \u003d 2$, $M \u003d 1$ and $4$\nruns, we would have the string $110110$, which is the binary representation of $54$.\u003c/p\u003e\n\n\u003cp\u003eAcknowledging Sheldon’s powerful insight, let us introduce the concept of a Sheldon number: a positive integer whose binary representation matches the pattern \u003ci\u003eABABAB . . . ABA\u003c/i\u003e\nor the pattern \u003ci\u003eABABAB . . . AB\u003c/i\u003e, where all the occurrences of $A$ represent a string with\n$N$ occurrences of the bit $1$ and where all the occurrences of $B$ represent a string with $M$\noccurrences of the bit $0$, with $N \u003e 0$ and $M \u003e 0$. Furthermore, in the representation,\nthere must be at least one occurrence of the string $A$ (but the number of occurrences of\nthe string $B$ may be zero).\u003c/p\u003e\n\n\u003cp\u003eMany important numbers are Sheldon numbers: $1755$, the year of the great Lisbon earthquake, $1984$, of Orwellian fame, and $2015$, the current year! Also, $21$, which Sheldon\nmentions, is a Sheldon number, and so is $42$, the answer given by the Deep Thought\ncomputer to the Great Question of Life, the Universe and Everything.\u003c/p\u003e\n\u003cp\u003eClearly, there is an infinite number of Sheldon numbers, but are they more dense or less\ndense than prime numbers?\u003c/p\u003e\n\u003cp\u003eYour task is to write a program that, given two positive integers, computes the number of\nSheldon numbers that exist in the range defined by the given numbers.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input contains one line, with two space separated integer numbers, $X$ and $Y$ ($0\\leq X \\leq Y\\leq 2^{63}$)."}},{"title":"Output","value":{"format":"HTML","content":"The output contains one line, with one number, representing the number of Sheldon\nnumbers that are greater or equal to $X$ and less or equal to $Y$ ."}},{"title":"Example 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e1 10\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e10\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003cp\u003e\u003cb\u003eExplanation:\u003c/b\u003eAll numbers between 1 and 10 are Sheldon Numbers.\u003c/p\u003e"}},{"title":"Example 2","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e70 75\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003cp\u003e\u003cb\u003eExplanation:\u003c/b\u003e73 is the only Sheldon number in this range.\u003c/p\u003e"}}]}