```
public class Solution {
public int countNumbersWithUniqueDigits(int n) {
if(n == 0)
{
return 1;
}
if(n == 1)
{
return 10;
}
if(n>10)
{
return countNumbersWithUniqueDigits(10);
}
int suming = 1;
for(int i = 0;i<n-1;i++)
{
suming *= 9-i;
}
suming *= 9;
return suming + countNumbersWithUniqueDigits(n-1);
}
}
```