Find the sum of all positive integers $n$ for which $n^2-7n+21$ is a perfect square.
I received this problem in a competitive math contest in which the problems were fairly easy to me, but this one has had me puzzled for a couple of days. The other problems in the contest were not too hard to figure out the solution to, so I think that this one has a formula or something of that sort which makes it much easier.