SCU 2008 warmup contest 2

B: Match counting