The count for ways of doing each way of matching the bins was (popcount - popbinheight) ^ (sampcount - sampbinheight).
We also figured some things possibly around permutations and combinations, both.
And remember to simulate it to find more and more mistakes.