Well-solvable instances for the partition problem

We characterize all numbers n and S with the following property: Every instance of the partition problem that consists of n positive integers with sum S possesses a solution, that is, a partition into two subsets with equal sum.