2^n solution