The conjecture that there is at most a single solution to the equation $3^a-2^b=n$, provided $|n|>13$ (which implies that $f(n)$ is $0$ or $1$ for $n > 5$$n > 1$), dates back to Pillai and was proved by Stroeker and Tijdeman in 1982 (using lower bounds for linear forms in logarithms). One has (again, from linear forms in logarithms) inequalities of the shape $$ \left| 3^a - 2^b \right| > 2^{0.9b}, $$ by way of example, valid for something like $b > 3$. This enables one to compute $f(n)$ efficiently and to show that the asymptotic density of zeros in the sequence of values of $f(n)$ is one. If you assume that $a$ and $b$ are positive, $3^a-2^b$ is odd and so there are never consecutive occurrences of $f(n)=1$.