The formula for the number of diagonals \( D \) of a regular polygon with \( n \) sides is:
\[
D = \frac{n(n - 3)}{2}
\]
Given \( D = 104 \), we substitute into the formula:
\[
\frac{n(n - 3)}{2} = 104
\]
\[
n(n - 3) = 208
\]
\[
n^2 - 3n - 208 = 0
\]
Solving this quadratic equation:
\[
n = \frac{-(-3) \pm \sqrt{(-3)^2 - 4(1)(-208)}}{2(1)} = \frac{3 \pm \sqrt{9 + 832}}{2} = \frac{3 \pm \sqrt{841}}{2}
\]
\[
n = \frac{3 \pm 29}{2}
\]
Thus, \( n = \frac{3 + 29}{2} = 16 \) or \( n = \frac{3 - 29}{2} = -13 \). Since \( n \) must be a positive integer, we have \( n = 16 \).