You are given a non-negative integer n.
A number is called binary-palindromic if its binary representation (without leading zeros) reads the same forward and backward.
Your task is to return the count of all numbers k such that:
0≤k≤n
and the binary representation of k is a palindrome.
Note: The number 0 is considered binary-palindromic, and its binary form is "0".
Input: n = 12
Output: 6
Input: n = 4
Output: 3
Accepted:
Submission: