How many 18-digit numbers n (without leading zeros) are there such that no digit occurs more than three times in n?