Find the integer $n$ such that:
\[
n + \lfloor \sqrt{n} \rfloor + \lfloor \sqrt{\sqrt{n}} \rfloor = 2017.\]

Here, $\lfloor \cdot \rfloor$ denotes the floor function.

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