How to end the game when only one team or player is left alive

Can you set up a Player Counter Device for each team, enabled after game start, and hooked up to an end game device when either counter hits 0