Note that $3^{1024}$-1=($3^{512}$+1)($3^{256}$+1)($3^{128}$+1)?(3+1)(3-1).
All 11 factors are even, and 3+1 is a multiple of 4.
Clearly 3-1 is not divisible by 4.
We claim that neither is any of the other 9.
When the square of an odd number is divided by 4,
the remainder is always 1.
Adding 1 makes the remainder 2, justifying the claim.
Hence the maximum value of
n is 12.