Number of homomorphism between a free group $F(S)$ and a group $G$

Let $$F(S)$$ be a free group with finite rank, $$G$$ a group with order $$n$$.

I want to know if the universal property can help determine the number of homomorphisms $$F(S)\rightarrow G$$. Say $$H$$ is the number of certain homomorphisms.

By the universal property, let $$\varphi:S\rightarrow G$$ be a set map, then there exists a unique homomorphism $$\Phi(s_1^{a_1}s_2^{a_2}\cdots)=\varphi(s_1)^{a_1}\varphi(s_2)^{a_2}\cdots$$.

There are $$n^{|S|}$$ set maps $$\varphi$$, hence $$H\geq n^{|S|}$$ (Is this true even when $$G$$ is not simple? If this is not always true, then when?).

(When) Can we say that $$H=n^{|S|}$$?

In the worst case I holp it at least works for $$G=\mathbb{Z}/2\mathbb{Z}$$.

-- Thanks

As $$\text{Hom}(F(S),G)$$ is in natural correspondence with $$\text{Map}(S,G)$$, they are equinumerous: there are $$|G|^{|S|}$$ homomorphisms from $$F(S)$$ to $$G$$.