------
## 最终结论
```python
def has_repeated_digits(num):
    num_str = str(num)
    return len(num_str) != len(set(num_str))

def count_numbers_with_repeated_digits(N):
    count = 0
    for i in range(1, N + 1):
        if has_repeated_digits(i):
            count += 1
    return count

# Example usage:
print(count_numbers_with_repeated_digits(20))   # Output: 1
print(count_numbers_with_repeated_digits(100))  # Output: 10
print(count_numbers_with_repeated_digits(1000)) # Output: 262
```