Start with an integer $N_0 > 0$. Let $N_1$ be the number of ones in the binary representation of $N_0$. For example, if $N_0 = 27$, then $N_1 = 4$.
In general, let $N_i$ be the number of ones in the binary representation of $N_{i-1}$. This sequence always converges to one.
For any starting number $N_0$, let $K(N_0)$ be the smallest index $i$ such that $N_i = 1$. For example, if $N_0 = 31$, then $N_1 = 5$, $N_2 = 2$, $N_3 = 1$, so $K(31) = 3$. In particular, $K(1) = 0$, since $N_0 = 1$ is already one.
Given a range of consecutive integers and a value $X$, how many numbers in the range have a $K(\ldots)$ value equal to $X$?
The input contains several test cases. Each test case is a single line with three integers:
LO HI X
where $LO$ and $HI$ ($1 \le LO \le HI \le 10^{18}$) are the lower and upper limits of a range of integers, and $X$ ($0 \le X \le 10$) is the target value for $K(\ldots)$.
The input ends with a line containing three zeros, which is not processed.
For each test case, print a single line with one integer: the number of integers in the range $[LO, HI]$ (inclusive) whose $K(\ldots)$ value equals $X$.