Solution:
First, we claim that the set {2,4,8,256,65536} is not good. Assume the contrary and say 2∈S. Then since 22=4, we have 4∈T. And since 44=256, we have 256∈S. Then since 2562=65536, we have 65536∈T. Now, note that we cannot place 8 in either S or T, contradiction.
Hence n≤65536. And the partition S={2,3}∪{256,257,…,65535} and T={4,5,…,255} shows that n≥65536. Therefore n=65536.