------
## 最终结论
```python
def count_combinations_less_than_n(digits, n):
    str_n = str(n)
    length_n = len(str_n)
    count = 0
    
    # Count numbers with fewer digits than n
    for i in range(1, length_n):
        count += len(digits) ** i
        
    return count

def count_combinations_equal_to_n(digits, n):
    str_n = str(n)
    length_n = len(str_n)
    count = 0
    
    def backtrack(index, is_limit):
        nonlocal count
        if index == length_n:
            count += 1
            return
        
        for digit in digits:
            if is_limit and digit > str_n[index]:
                break
            if index == 0 and digit == '0':
                continue
            
            backtrack(index + 1, is_limit and (digit == str_n[index]))
    
    digits.sort()  # Ensure digits are sorted for proper comparison
    backtrack(0, True)
    
    return count

def count_numbers(digits, n):
    str_n = str(n)
    count = 0
    
    count += count_combinations_less_than_n(digits, n)
    count += count_combinations_equal_to_n(digits, n)
    
    return count

# Example usage:
digits1 = ["1","3","5","7"]
n1 = 100
print(count_numbers(digits1, n1)) # Output: 20

digits2 = ["1","4","9"]
n2 = 1000000000
print(count_numbers(digits2, n2)) # Output: 29523

digits3 = ["7"]
n3 = 8
print(count_numbers(digits3, n3)) # Output: 1
```