#P1590. 失踪的7

失踪的7

Description

The ancient Pascal people also used Arabic numerals to count, but they disliked using 77 because they considered 77 an unlucky number. Therefore, Pascal number 88 actually represents 77 in the natural numbers, and 1818 represents 1616. Please compute how many Pascal numbers are contained within the range of positive integers up to nn.

Input Format

The first line contains a positive integer tt. Then follow tt lines, each containing a positive integer nn, and it is guaranteed that the input nn is a Pascal number.

Output Format

For each positive integer nn, output the number of Pascal numbers not exceeding nn.

2
10
20
9
18

Hint

For all testdata, 1t100001 \leq t \leq 10000, 1n23211 \leq n \leq 2^{32} - 1.

Translated by ChatGPT 5