That doesn't even work for the examples provided by the OP. "What is important is getting the brackets in the right places", yet there are 4 pairs of brackets missing for n=8. Your solution only works for n=2 and n=4, and it's not even exact for n=2.