I was reading through applications of Lagrangian mechanics and the case of coupled oscillators. The example provided is the famous two pendula length $l$ mass $m$ hanging from the ceiling connected by a spring with spring constant $k$. We call their angles $\theta_1$ and $\theta_2$ as measured from the vertical. The total kinetic energy of the system is:
$$ T = \frac{1}{2}mv_1^2+\frac{1}{2}mv_2^2=\frac{1}{2}ml^2(\dot{\theta_1}^2+\dot{\theta_2}^2)$$ Meanwhile the potential energy can be found to be: $$ U = mgl(1-\cos \theta_1) + mgl(1-\cos \theta_2)+ \frac{1}{2}k(l\sin \theta_2- l\sin \theta_1)^2$$ Where we get this from the fact that thw horizontal position of each bob is $x_i= l\sin \theta_i$. Then we get the Lagrangian by $L=T-U$ and the equations of motion from the Euler-Lagrange equation, etc.
My question relies on how this potential energy is found. Of course there are two contributions to the potential energy: the gravitational potential energy and the spring potential energy. The total gravitational potential energy is the sum of each bob's gravitational potential energy as we see in $U$.
However, the spring potential energy seems weird to me. We know that $\frac{1}{2}kx^2$ gives the spring potential energy for a particle connected to a spring displaced by a distance $x$ from equilibrium. However this is the energy for each particle, so (I don't know if this question is too stupid, but) why is the total spring potential energy equal to $$\frac{1}{2}k(x_2-x_1)^2$$ and not the sum of the two, which would be $$\frac{1}{2}k(x_2-x_1)^2+\frac{1}{2}k(x_1-x_2)^2 =k(x_2-x_1)^2$$ Of course the first one is right since it gives the correct EOMs, but can anyone provide an explanation on why we take just one of the potential energy contributions and not the two? Why would the second one be "overcounting"?