Let $n \ge 4$ be the number of vertices of the regular polygon. I work in the complex plane, so I may assume that $A, B, C, D$ are represented by the complex numbers $re^{ik2\pi/n}$ for $k=0,1,2,3$.
So we have to solve $|e^{i2\pi/n}-1|^{-1} = |e^{i4\pi/n}-1|^{-1}| + |e^{i6\pi/n}-1|^{-1}$, namely (using Euler formulas) $\sin(\pi/n)^{-1} = \sin(2\pi/n)^{-1}+\sin(3\pi/n)^{-1}$.
Multiplying both sides by $\sin(\pi/n)$ and using trigonometric formulas yields
$$1 = \frac{1}{2\cos(\pi/n)} + \frac{1}{4\cos^2(\pi/n)-1},$$
$$2\cos(\pi/n)(4\cos^2(\pi/n)-1) = 4\cos^2(\pi/n)-1 + 2\cos(\pi/n).$$
Hence $\cos(\pi/n)$ is a solution of the equation $8x^3-4x^2-4x+1=0$.
On the other hand, set $a = \cos(2\pi/7)$, $b = \cos(4\pi/7)$, $c=\cos(6\pi/7)$. Then $a>b>c$ since $\cos$ decreases on $[0,\pi]$.
$$1 + 2a + 2b + 2c = \sum_{k=-3}^3 e^{i2k\pi/7} = 0.$$
Trigonometric identities yields $b=2a^2-1$ and $c=4a^3-3a$. Hence
$8a^3+4a^2-4a-1=0$.
We also have $8b^3+4b^2-4b-1=0$ since $c = \cos(8\pi/7) = 2b^2-1$ and $a = \cos(12\pi/7) = 4b^3-3b$.
In the same way, $8c^3+4c^2-4c-1=0$ since $a = \cos(12\pi/7) = 2c^2-1$ and $b = \cos(18 \pi/7) = 4c^3-3c$.
As a result, the three roots of the equation $8x^3-4x^2-4x+1=0$ are
$-a = \cos(5\pi/7)$, $-b = \cos(3\pi/7)$, $-c = \cos(\pi/7)$.
Since $\cos$ decreases on $[0,\pi]$, we derive $\pi/n = \pi/7$, $3\pi/7$ or $5\pi/7$. The only possibility is $n=7$.