Ring homomorphisms $\mathbb{R} \to \mathbb{R}$.

I got this question in a homework:

Determine all ring homomorphisms from $\mathbb{R} \to \mathbb{R}$. Also prove that the only ring automorphism of $\mathbb{R}$ is the identity.

I know that $\mathbb{R}$ is a field, so the only ideals are $\mathbb{R}$ and $\{0\}$. Therefore the homomorphisms must be the identity and the function $f(x)=0$ where $x \in \mathbb{R}$.

But how do I prove these are the only two homomorphisms?

Also, I was told to use the fact that $\mathbb{Q}$ is dense in $\mathbb{R}$, how can I use this hint?

Solutions Collecting From Web of "Ring homomorphisms $\mathbb{R} \to \mathbb{R}$."

$f\colon \mathbb R\to\mathbb R$ is uniquely determined by $f(1)$. Why?
By induction, $f(n)=n\cdot f(1)$ for $n\in\mathbb N$. Then by additivity, $f(x)=x\cdot f(1)$ for $x\in \mathbb Z$ and finally also for $x\in\mathbb Q$.
We can make use of the densitiy of $\mathbb Q$ if we show that $f$ is continuous.
Indeed, if $x\ge0$ then $x=y\cdot y$ for some $y\in\mathbb R$, hence $f(x)=f(y)f(y)\ge 0$, therefore $f$ preserves $\ge$ and hence $|y-x|\le \frac 1n$ implies $|f(y)-f(x)|\le \frac1n|f(1)|$, that is $f$ is continuous. We conclude that $f(x)=x\cdot f(1)$ for all $x\in\mathbb R$.

What values of $f(1)$ are allowed? We must have $f(1)=f(1\cdot 1)=f(1)\cdot f(1)$, hence $f(1)=0$ or $f(1)=1$.