Show how counting semaphores (i.e. semaphores that can hold an arbitrary value) can be implemented using binary semaphores and ordinary machine instructions.

calculation for density and frequency from quadrant