The 2N Relation

Let $$f$$ be a function from the positive integers to the positive integers satisfying

$f(1) = 2, f(2) = 1, f(3n) = 3f(n)$ $f(3n+1) = 3f(n) + 2, f(3n+2) = 3f(n) + 1.$

How many positive integers $$N \leq 1000$$ satisfy $$f(N) = 2N$$?

×