The initial number of inhabitants in a city, which is greater than 150, is a perfect square. With an increase of 1000 inhabitants, it becomes a perfect square plus one. After another increase of 1000 inhabitants, it becomes a perfect square again. Determine the initial number of inhabitants in the city.

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