4. Given the set $A=\{1,5\}, B=\left\{x^{2}-3 x+1, x^{2}-4 x+5\right\}$, if the number of elements in the set $A \cup B$ is 3, then the real number $x=$
Solve:
$x^{2}-3 x+1=1 \Rightarrow x_{1}=0$ (not suitable) or $x_{2}=3$, at this time $A \cup B=\{1,5,2\}$; $x^{2}-3 x+1=5 \Rightarrow x_{3}=4$ (not suitable) or $x_{4}=-1$, at this time $A \cup B=\{1,5,10\}$; $x^{2}-4 x+5=1 \Rightarrow x_{5}=2$, at this time $A \cup B=\{1,5,-1\}$; $x^{2}-4 x+5=5 \Rightarrow x_{6}=0$ (not suitable) or $x_{7}=4$ (not suitable). In summary, $x=-1$ or 2 or 3.