Finding $x_1+x_2$, where the $x_i$, and $y$ and $z$, are positive integers satisfying $x^2+y^2+z^2=2(xy+1)$ and $x+y+z=2022$ 
Let $x$, $y$, and $z$ be positive integers satisfying
$$(x)^2+(y)^2+(z)^2=2(xy+1) \quad\text{and}\quad x+y+z=2022$$
If $x_1$ and $x_2$ are 2 distinct solutions for $x$, what is the value of $x_1+x_2$?

Attempted to express $(x)^2+(y)^2+(z)^2=2(xy+1)$ as $(x-y)^2+(z)^2=2$, then I'm stuck.
Kindly advise! Thanks!

So we have , $$(x-y)^2+z^2=2$$
Since $(x,y,z)\in\mathbb Z^+$ we can say $|x-y|=1$ and $z=1$ [ It is because only $1^2 ,1^2$ are the positive integers that sum upto $2$ ]
We have also given that , $$x+y+z=2022$$ $$x+y=2021$$
Now : $$x+y=2021$$ $$x-y=1$$ ​
From these  two linear equations in two variable you'll get  , $$(x,y)\in\{1010,1011\}$$
Here you go you have two distinct values of $x$ .
