count categories+facet_wrap

I don't understand what you mean, it is exactly the same code. Please read this forum guidelines about how to properly ask coding related questions.