Let $$n=p_1×p_2×p_3×\dots×p_r$$ where $p_i$ are prime factors and $f$ is the functions $$f(n)=p_1^2+p_2^2+\dots+p_r^2$$ If we put $n=27,16$ and $27=3×3×3$, $16=2×2×2×2$ then $$\begin{split}f(27)&=3^2+3^2+3^2=27\\f(16)&=2^2+2^2+2^2+2^2=16.\end{split}$$ I checked it upto $n=10000$, I did not find another number with this property $f(n)=n$.
Can we prove that other such numbers do not exist?
Some approaching values
$f(992)=981\\f(1058)=1062\\f(1922)=1926\\f(5396)=5410\\f(7198)=7206\\f(9506)=9511$
Sequence: A067666, Sum of squares of prime factors of n (counted with multiplicity).
Edit
We can show there are infinitely many $n$ s.t. $f(n)=n+4$
Proof: put $n=2\cdot p^2$ where $p$ prime number
gives $f(2\cdot p^2)=2^2+p^2+p^2=4+2\cdot p^2$.