```
public class Solution {
public int countNumbersWithUniqueDigits(int n) {
if(n<0){
return 0;
}
if(n == 0){
return 1;
}
int sum = 10;
int cnt = 1;
int num = 9;
while(cnt < n){
num *= (9 -cnt +1);
sum += num;
cnt ++;
}
return sum;
}
```

}