Counting Sort — step by step

Keys are small non-negative integers: sort by counting occurrences, not by comparing.
Setup
Input array A
Count array C (occurrences of each key)
Output array B (sorted)