First work out the state space. It's built into the setup that the state space contains $\{ 0,1,2,3 \}$, and in fact it doesn't contain anything else, as you can check by checking that if $X_n \in \{ 0,1,2,3 \}$ then no matter what $Y_n$ is, you will have $X_{n+1} \in \{ 0,1,2,3 \}$.
From there just build the transition matrix case by case. (Here I use the convention that $P_{ij}$ is the probability to go from $i$ to $j$; sometimes the reverse convention is used.) The first row will be the transition probabilities for when $X_n$ is currently $0$. These are just the probabilities for $Y_n$, i.e. $2/3,1/6,1/6,0$ (since $Y_n$ is never $3$). The second row is the transition probabilities for when $X_n$ is currently $1$. And so on.
To find the invariant distribution, you have to solve the linear system $\pi = \pi P$ where $P$ is the transition probability matrix and $\pi$ is the invariant distribution (written as a row vector), and then normalize it into a probability distribution. This can be done by row reduction; numerically it is usually better to use an eigenvalue routine (since singular matrices are "bad" numerically speaking).