```
public int countNumbersWithUniqueDigits(int n) {
if (n == 0)
return 1;
int res = 0;
return helper(res, n);
}
private int helper(int res, int n) {
if (n == 1)
return res + 10; / /one digit
int result = 1;
for (int i = 11 - n; i <= 9; i++)
result *= i;
result *= 9;
return helper(res + result, --n);
}
```