Counting combinations or pairs