Number of elements in the range of $f(x) = \lfloor x^2 \rfloor - \lfloor x \rfloor^2$ 
If $f(x) = \lfloor x^2 \rfloor - \lfloor x \rfloor^2$, and $x \in [0,n]$ where $n \in \mathbb{Z} $
  then the number of elements in the range of $f(x)$ is:-
$$1.) \ 2n+1$$
$$2.)\ 4n-3$$
$$3.)\ 3n-3$$
$$4.)\ 2n-1$$

I tried it like this. 
Let $x=I+f$, where $I$ is $\lfloor x \rfloor$ and $f$ is fractional part of $x$. So, 
$$f(x) = \lfloor (I+f)^2 \rfloor - I^2$$
$$f(x) =  \require{cancel}\cancel{I^2} +\lfloor 2If+f^2 \rfloor - \cancel{I^2}$$
$$f(x) =\lfloor 2If+f^2 \rfloor $$
But I am stuck on this step, please help me out. Thanks in advance.
 A: It is less helpful to try to solve for $f(x)$ explicitly though, as you can already figure out an upper and lower bound for $f(x)$; $l \le x < l+1$ without having to do that.
Let us write $l = \lfloor x \rfloor$. Then $f(x) = \lfloor x^2 \rfloor - l^2$ is always an integer, and can be as large as $(l+1)^2-1-l^2 = 2l$ [for $x$ close to $l+1$] but no larger; and of course can be as small as 0, if $x-l^2$ is close to 0 [make sure you see why]. So the number of elements in the range of
$\lfloor x^2 \rfloor - l^2$ $=$ $\lfloor x^2 \rfloor - \lfloor x \rfloor ^2$ $=f(x)$; where $x$ varies $l \le x < l+1$ can be precisely as large as $2l+1$. [make sure you see why]. So the number of elements in the range of
$\lfloor x^2 \rfloor - l^2$ $=$ $\lfloor x^2 \rfloor - \lfloor x \rfloor ^2$ $=f(x)$; where $x$ varies $l \le x \le l+1$ can be precisely as large as $2l+1$. [make sure you see why]
So can you use this to conclude that the number of elements in the range of $\lfloor x^2 \rfloor - \lfloor x \rfloor ^2$; $x \in [0,n]$ can be as large as $2(n-1)+1$ $=2n-1$ but no larger.
