Neater version,
thanks to Etoplay.
(“Just put the abs below the fraction. ...”)
$ \kern9em \llap{\color{black}{ f(n) ~~ = }} ~~~ \dfrac{ n }{ |n{-}1| + 1 } $
$ \kern9em \llap{\color{black}{ f(0) ~~ = }} ~~~ \dfrac{ 0 }{ |0{-}1| + 1 } ~~=~~ \dfrac0{1{+}1} \color{black}{~~=~~0} $
$ \kern9em \llap{\color{black}{ f \, ( \, n{=}1,2,3,\ldots\, ) ~~ = }} ~~~~ \dfrac{n}{ n{-}1 + 1 } ~~~=~~~~\, \dfrac{n}{n} \color{black}{\,~~~=~~1} $
(Can be made to work for all integers by replacing $n$ with $|n|$
in the formula, and for almost all
reals — all but $~ 0 < |n| < \epsilon \,$— by
replacing $1$ with an arbitrarily small $\epsilon$.)
Original solution, taking
$\mathbb N$
to mean 1,2,3,...
and acknowledging $~ |x| = \sqrt{x^2} ~$ as an elementary function:
$ \kern5em \color{black}{ f(n)~=~ } \dfrac{ |3n{-}1| - 1 }{ 3n{-}2 } $
$ \kern5em \color{black}{ f(0)~=~~~ } \dfrac{ |0{-}1| - 1 }{ 0-2 } ~~~=~~ \dfrac{1-1}{-2} \color{black}{~~=~~0} $
$ \color{black}{ f(n{=}1,2,3,\ldots)~=~ } \dfrac{ (3n{-}1) - 1 }{ 3n-2 } ~~=~~ \dfrac{3n-2}{3n-2} \color{black}{~~=~~1} $
(This came from an intuition for $~ n{-}\frac12 ~$
that surprisingly trespassed $0/0$ for $~ n=1$.
Haven't yet thought of a neat variation
that works for all reals, such as
$~ n = \frac23 ~$ and $~ 0 \ne n < \frac13 ~$ in this case.)