class Solution {

public:

int countNumbersWithUniqueDigits(int n) {

if(n==0) return 1;

int result = 10,product = 9,sum = 9;

for(int i=2;i<=n;++i){

sum *= product;

--product;

result += sum;

}

return result;

}

};