7. Given the following two sets of data:
First set: $20,21,22,25,24,23$; Second set: $22,24,23,25, a, 26$
If the variances of the two sets of data are equal, then the value of the real number $a$ is $\qquad$ .
$$
\bar{x}=\frac{1}{6}(20+21+22+23+24+25)=22.5, S_{x}^{2}=\frac{1}{3}\left(2.5^{2}+1.5^{2}+0.5^{2}\right)=\frac{1}{3} \times 8.75 \text {; }
$$

Divide the data into two layers: $22,23,24,25,26 ; a$, where $\overline{y_{1}}=24, S_{1}^{2}=2, \overline{y_{2}}=a, S_{2}^{2}=0$.
Then $\bar{y}=\frac{5 \times 24+a}{6}, S_{y}^{2}=\frac{5}{6}\left[2+\left(\frac{5 \times 24+a}{6}-24\right)^{2}\right]+\frac{1}{6}\left(\frac{5 \times 24+a}{6}-a\right)^{2}$
$$
=\frac{5}{3}+\frac{1}{6}\left[5\left(\frac{a-24}{6}\right)^{2}+25\left(\frac{24-a}{6}\right)^{2}\right]=\frac{5}{3}+\frac{5}{36}(a-24)^{2} \text {, }
$$

Thus $\frac{5}{3}+\frac{5}{36}(a-24)^{2}=\frac{1}{3} \times 8.75 \Rightarrow \frac{5}{36}(a-24)^{2}=\frac{5}{4} \Rightarrow(a-24)^{2}=9 \Rightarrow a=21$ or 27 .