# Hopping forever

After the previous exercise, Brilli the bug is ready for another session of hopping. It starts on the number line at the point $$0$$. For all $$i = 1, 2, 3, \ldots$$, on the $$i$$-th step, it hops a distance of $$2^{i-1}$$ units, either to the left or to the right.

Let $$f$$ be a function from the integers to the nonnegative integers, such that $$f(n)$$ is $$0$$ if Brilli can never reach $$n$$ in a finite number of steps, and the minimum number of moves required to reach $$n$$ otherwise. Compute $\displaystyle\sum_{n=1}^{2015} f(n)$

×