put all 0 at starting and 1 at end in array