So $X_n$ is a Markov chain with state space $\{0,1,2,3,4\}$ and $X_0=0$. Let us determine the transition matrix:
When $X_n \leq 1$, then $X_{n+1}=A_{n+1}$, because you dispatch the potential packet in the buffer before getting another one.
When $X_n \geq 2$, then $X_{n+1} = \min(4,X_n-1+A_{n+1})$.
So, writing everything out, the transition matrix (I'm considering the probability distributions of the $X_k$ as column vectors) is:
$P=\begin{bmatrix}
0.25 & 0.25 & 0 & 0 & 0\\
0.25 & 0.25 & 0.25 & 0 & 0\\
0.25 & 0.25 & 0.25 & 0.25 & 0\\
0.25 & 0.25 & 0.25 & 0.25 & 0.25\\
0 & 0 & 0.25 & 0.5 & 0.75\\
\end{bmatrix}$
Now, depending on the values of $X_n$ and $A_{n+1}$, we split into different cases:
$X_n \leq 2$: $Y_{n+1}=0$ (one packet is dispatched so there remains at most one, and at most three are added so none need to be dismissed)
$X_n = 3$: $Y_{n+1} = 1$ if $A_{n+1}=3$ and $0$ otherwise (explanation is similar to that below)
$X_n = 4$: then we dispatch one packet, (three remain) and add $A_{n+1}$ of them, and dismiss all the packet but four: thus the number of packets dismissed is $0$ if $A_{n+1} \leq 1$, $1$ if $A_{n+1} = 2$, and $2$ if $A_{n+1}=3$.
Having written this all out, we can write:
$\mathbb{E}[Y_{n+1}|X_0=0] = \mathbb{E}[Y_{n+1}1(X_n \geq 3)|X_0=0]$ (as $Y_{n+1}1(X_n \leq 2)=0$) and then split by linearity over the values of $A_{n+1}$ and $X_n$:
$\mathbb{E}[Y_{n+1}|X_0=0]=\mathbb{E}[1(X_n=3,A_n=3)+(A_{n+1}-1)^+1(X_n=4)|X_0=0]$.
Now, $\sigma(A_{n+1})$ and $\sigma(X_0,\ldots,X_n)$ are independent, so by the properties of conditional expectations, $\mathbb{E}[1(X_n=3,A_n=3)|X_0=0] = \mathbb{E}[1(A_n = 3)]\mathbb{E}[1(X_n=3|X_0=0)] = P(A_{n+1} = 3)P(X_n=3|X_0=0)=\frac{1}{4}p^{(n)}_{3,0}$ (I'm using column vectors to be applied to transition matrices, hence possibly the index reversal).
Similarly, $$\mathbb{E}[(A_{n+1}-1)^+1(X_n=4)|X_0=0] = \mathbb{E}[(A_{n+1}-1)^+]\mathbb{E}[1(X_n=4)|X_0=0] = \frac{1}{4}\left((0-1)^++(1-1)^++(2-1)^++(3-1)^+\right)p^{(n)}_{4,0} = \frac{3}{4}p^{(n)}_{4,0},$$ which shows the final formula:
$$\mathbb{E}[Y_{n+1}|X_0=0] = \frac{1}{4}p^{(n)}_{3,0}+\frac{3}{4}p^{(n)}_{4,0},$$ which we wanted to show.
Best Answer
In general, if $\mathcal{G}$ is a $\sigma$-field s.t. $S$ is $\mathcal{G}$-measurable and $X$ is independent of $\mathcal{G}$, then for any integrable function $\varphi$, $\mathsf{E}[\varphi(S,X)\mid \mathcal{G}]=g(S)$ a.s., where $g(s):=\mathsf{E}\varphi(s,X)$. Apply this result to your case with $\mathcal{G}=\sigma\{X_1,\ldots,X_n,Y_1,\ldots,Y_n\}$, assuming that $X_{n+1}$ is independent of $\mathcal{G}$ (see @Michael's comments and examples 1, 2, and 3).