Let's use a diagram:
We can find the displacement as:
[tex]\begin{gathered} \Delta x=_{\text{ }}xf-xi \\ _{\text{ }}where\colon \\ xi=X \\ xf=Y \\ \Delta x=Y-X \end{gathered}[/tex]And the distance is given by:
[tex]\begin{gathered} d=xi+xf \\ d=X+Y \end{gathered}[/tex]