A new year indeed

Define a function $$\displaystyle f(n) = n + \left \lfloor \sqrt{n} \right \rceil$$. Find the sum of all the values of $$k(\leq 2017)$$ such that the composite function $$f^{k} (n) = \underbrace{f\circ f \circ f \circ \cdots \circ f}_{k \text{ times}} (n)$$ is a square of integer.

Notation: $$\lfloor \cdot \rceil$$ denotes the nearest integer function (round).

×