Bloomberg interview question

Implement a mutex. Using binary semaphore, implement an n-counting semaphore.