It would appear that the behavior of this sequence is determined by values of the Jacobsthal numbers J(n)=A001045(n): a(n)=1 only if n=J(2k),k=0,1,...; a(n)=2 only if n=J(2k+3)+2J(2j), some k,j>=0, otherwise a(n)=0.