division problem

Pourpose: I need the solution for a problem in my B. tech project.

Hi all,

I have 'n' numbers between 0 and 1 .... and there sum 'S' is known .. so there are only two things 'n' & 'S' are known .... now I have to divide these 'n' numbers into two groups of (0, .5) & (.5, 1) ... I need numbers of elements & their sum in each group .... This can't be done arbritrarily .... solution using some distribution or statistical argument will be good ...

Interval No. of elements Sum


(0,1) 'n' 'S' {We know}

(0,.5) 'n1' 'S1' {need to find}

(.5,1) 'n2' 'S2' {need to find}

Please suggest something asap


Clarification: The 'n' numbers are instances of 'n' independent random variables which can take values between 0 and 1 .... The distribution is not known to me .... u can assume anything .... but the assumption should be reasonable ....