> the code looks safe to disable bounds checking as well
I tried disabling both boundschecks and wraparound and it was difficult to distinguish a speed up from noise (< 3% if at all).

Re. typing the args, `counts` isn't typed because it can be a list, array, etc. Typing `n` doesn't make a difference.