Let $m$ be a positive integer and the expansion of $(\sqrt{2}+1)^m$ be $$(\sqrt{2}+1)^m=x_m\cdot\sqrt{2}+y_m\quad\text{and}\quad(\sqrt{2}-1)^m=x_m\cdot\sqrt{2}-y_m$$
where $x_m$ and $y_m$ are some integers. Multiplying these two equations yields: $$(\sqrt{2}+1)^m(\sqrt{2}-1)^m=(x_m\cdot\sqrt{2}+y_m)(x_m\cdot\sqrt{2}-y_m)\implies 2x_m^2 -y_m^2=1$$
$$\therefore\quad 2x_m^2 > y_m^2 \implies y_m<\sqrt{2}\cdot x_m$$
Meanwhile, $$2x_m^2 = y_m^2 +1 \implies 2(x_my_m)^2 = y_m^4 + y_m^2 > y_m^4$$
Consequently, it must hold that $$y_m^2 <\sqrt{2}x_my_m < 2x_m^2 = y_m^2+1\implies y_m^2 <\sqrt{2}x_my_m < y_m^2+1$$
Now, let $n=x_my_m$, then $a_n=\lfloor{n\sqrt{2}}\rfloor=y_m^2$ which is a square number. Because this results holds for any positive integer $m$, therefore there exist an infinite number of distinct $n=x_my_m$.