Functions and the Intermediate Value theorem

Homework Statement

Let f : [0; 1] --> R be continuous on [0, 1], and assume that the range of f is contained
in [0; 1]. Prove that there exists an x in [0, 1] satisfying f(x) = x.

The Attempt at a Solution

Well i am almost positive I need to use the intermediate value theorem.

First I could claim that either f(0)>x>f(1) or f(0)<x<f(1). where x is a value in (0,1)
Not too sure what to do, i think the key is something to do with the range of f being contained in [0,1], but any help would be great!

If f(0)= 0, we are done. If f(1)= 1, we are done. So we can assume that $f(0)\ne 0$ and that $f(1)\ne 1$. But f(0) must be in [0, 1]. If it is not equal to 0, then f(0)> 0. Similarly, we must have f(1)< 1. Define H(x)= f(x)- x. What is H(0)? What is H(1)? Apply the intermediate value theorem to H(x).