Let's say that you flip a coin $n$ times and $X$ is the number of times tails appeared. Next, you flip the coin once for every tail in the first round (i.e. $X$ times) and $Y$ is the number of tails appeared in this round.

How do I go about calculating the joint pmf of $X$ and $Y$? I'm struggling to set the problem up.