1991 AIME Problem 15

For positive integer n, define S_{n} to be the minimum value of the sum

\sum_{k=1}^{n} \sqrt{(2 k-1)^{2}+a_{k}^{2}}

where a_{1}, a_{2}, \ldots, a_{n} are positive real numbers whose sum is 17. There is a unique positive integer n for which S_{n} is also an integer. Find this n.