Homeomorphism and Mapping Having some trouble understanding this:

$(S,\circ)$ and $(J,\times)$ be two groups and $f\colon S \to J$ be a homeomorphism. Prove that $f$ maps the identity of $S$ to the identity in $J$.

Any guides on where to step first. Feeling lost.
$f(e)=f(ee)=f(e)f(e)$
But $f(e)=e_Mf(e)$ so we have:
$$f(e)f(e)=e_Mf(e)$$
But recall the cancellation laws, $ax=bx \implies a=b$
We have $f(e)f(e)=e_Mf(e)\implies f(e)=e_M$ as required.
This completes the proof.
$f(g) = f(e\circ g) = f(e)\times f(g)$ and  $f(g) = f(g\circ e) = f(g)\times f(e)$

this is true for all $g\in S$ thus $f(e)$ has to be the identiy of $J$