add count for pattern