segregate array of 0s and 1s