### 1625: Numbairs

[状态] [讨论版] [提交] [命题人:]

Consider number of the form aa...a  where a is a positive integer that can appear in the notation
twice or more. Let us call such numbers numbairs (which stands for number + stairs). For instance,
both 27 = 33 and 16 = 22 are numbairs. Number 1 is, too, a numbair since 1 = 11. Find out how many
numbairs there are between 1 and a number n given to you (inclusive).

The first line of the input contains an integer T(1 ≤ T ≤ 10000), denoting the number of test cases.
In each test case, there is an integer n(1 ≤ n ≤ 109).

For each test case, print a single line containing an integer, denoting the number of numbairs not
exceeding n.

1
5

2