Let $f$ be a function defined on positive integers such that $f(1)=4$, $f(2n)=f(n)$ and $f(2n+1)=f(n)+2$ for every positive integer $n$. Find the number of positive integers $k$ less than $2014$ for which $f(k)=8$.

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