Find all functions $f: \mathbb{Z} \to \mathbb{Z}$ such that $$n^2+4f(n)=f(f(n))^2\quad(1)$$ for all $n \in \mathbb{Z}.$ Provide the number of distinct functional forms for $f(n)$.

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