Draw the queue like this, where $W$ is wallace and $G$ is gromit:
$$ \begin{array}{ccccc}
\cdots & G & \cdots & W & \cdots
\end{array}
$$
Let's call $a,b,c$ the number of people in line in each of the segments labelled "$\cdots$''. So there are $a$ people behind Gromit, $b$ people in between them, and $c$ people after Wallace. Let's think about what each statement in the original problem says:
- "There are $x$ people behind Wallace". This means $a+b+1 = x$
- "There are $n$ people in front of Gromit". This means $b+c+1 = n$.
- "Wallace is $y$ places in front of Gromit". This means $b=y-1$.
You should be able to use these equations to solve for $a$ and $c$. Finally, the total number of people in line is $a+b+c+2$.
Alternate Way: Add all the people behind Wallace plus all the people in front of Gromit. This gives $x+n$. But this double-counts all the people in between, of which there are $y-1$. So the total is $x+n-(y-1)$.