Inter-group competition and stable group sizes