Function to check if it is a power of 2 or not
public bool isPowerOfTwo ( int N ) { double number = Math . Log ( N ) / Math . Log ( 2 ) ; int checker = ( int ) number ; return number - checker == 0 ; }