count matches before masking