If a digit has occurred for the second time , then set repeated to 1
if ( ( mask & ( 1 << i ) ) > 0 ) { val += countOfNumbers ( digit + 1 , mask | ( 1 << i ) , 1 , n ) ; } else { val += countOfNumbers ( digit + 1 , mask | ( 1 << i ) , 0 , n ) ; } } }