const isPowerOfTwo = n => !!n && (n & (n - 1)) == 0;