Let $f(x)=|2\{x\}-1|$ where $\{x\}$ denotes the fractional part of $x$. The number $n$ is the smallest positive integer such that the equation \[nf(xf(x))=x\]has at least $2012$ real solutions. What is $n$?

Note: the fractional part of $x$ is a real number $y=\{x\}$ such that $0\le y<1$ and $x-y$ is an integer.

Let's think step by step and output the final answer within \boxed{}.
user