Is there a way I can get count++ to function on multiple variables simultaneously.

Say I have variable X, Y & Z and X occurs have it count and store 1 occurrence for X and 2 occurrences for Y etc..

But instead of having just variableX count++ and variableY count++ separate, have them combined something like..

variable()++ where whatever is inside () it will track and store for example 1 occurrence of X, 2 occurrences of Y etc.

What would I have to put inside the () to do this? Or if that's completely off is there anyway to accomplish this?