Thanks to James Graham's brilliant script, what could be a dry series of head counts is transformed into a thrilling evening of intrigue and laughter