List count of occurrences pairs, triplets, etc. from sets A receipt is an array of products. I have an array of receipts.

I need to generate a report in where I can find the products often bought together.

For instance, for a single receipt where the products bought are [A, A, B, B, B, C], a report would look like

Pair - count
A&amp;B - 2
A&amp;A - 1
B&amp;B - 1
A&amp;C - 1
B&amp;C - 1


Notice that pair B&amp;A is no longer counted because this is the same as A&amp;B, and similar occurrences. It also has to be sorted by count, decreasing. Also notice that this is just from one receipt rather than multiple, which is what is required.

I also need the algorithm to scale to triples and quadruples, not just pairs. 

How would I create an algorithm like this?

There are no set time efficiency constraints. In fact, a more readable solution is preferred over more efficient solutions although efficiency is also appreciated. A python solution is also appreciated, but any language or pseudocode will do.
This is the itemset mining problem.  Use any standard algorithm for that problem.  Follow the links to learn more about standard algorithms for that task.