Which boxes need to change?
Call a box mixed when its two balls have different colors. Let m be the number of mixed boxes. A monochrome box already meets its requirement, regardless of the colors in other boxes.
Both orders of the two colors describe the same kind of mixed box. Try expressing feasibility using only m.