Well, your proof is almost complete. Notice that each of the $d_i$ is less than $\sqrt{n}$ and they are different. There could be no more than $\sqrt{n}$ positive integers less than $\sqrt{n}$. So $k\leq\sqrt{n}$.
Well, your proof is almost complete. Notice that each of the $d_i$ is less than $\sqrt{n}$ and they are different. There could be no more than $\sqrt{n}$ positive integers less than $\sqrt{n}$. So $k\leq\sqrt{n}$.