Exactly two distinct elements means exactly two of $x^2$, $2^y$, $z$ are equal and the third is different. Split into three cases according to which two are equal.
Case $x^2=2^y\ne z$: $x$ must be a power of $2$, so $(x,y)$ is one of $(1,0),(2,2),(4,4),(8,6),(16,8)$, with common value $1,4,16,64,256$. The first three values are less than $20$, so $z$ has $19$ choices; for the last two, $z$ has $20$. That is $3\cdot19+2\cdot20=97$.
Case $x^2=z\ne2^y$: $z=x^2<20$ gives $x=0,1,2,3,4$ and $z=0,1,4,9,16$. Then $y$ must avoid $2^y=z$: $20$ choices when $z=0$ or $9$, and $19$ choices when $z=1,4,16$. That is $2\cdot20+3\cdot19=97$.
Case $2^y=z\ne x^2$: $z=2^y<20$ gives $y=0,1,2,3,4$ and $z=1,2,4,8,16$. Then $x$ must avoid $x^2=z$: $19$ choices when $z=1,4,16$, and $20$ when $z=2,8$. That is $3\cdot19+2\cdot20=97$.