use inject to count matches