Compute the number of positive integers $n \leq 1000$ such that $\text{lcm}(n, 9)$ is a perfect square. (Recall that $\text{lcm}$ denotes the least common multiple.)

Let's think step by step and output the final answer within \boxed{}.
user