Count of numbers whose 0 th and Nth bits are set | Function to return the count of n - bit numbers whose 0 th and nth bits are set ; Driver code
function countNum ( n ) { if ( n == 1 ) return 1 ; let count = Math . pow ( 2 , n - 2 ) ; return count ; } let n = 3 ; document . write ( countNum ( n ) ) ;