how many distinct sets can be formed QUESTION (Edited to make it more readable)
If A and B are two different nonempty sets, how many distinct sets can be formed with these sets using as many unions,intersections,complements and parentheses as desired.
EDIT: My question was actually about generalising the homework question above, i.e. the the "n" number of sets case.
We are debating if the answer is $2^{2^n - 1}$ or $2^{2^{n}}$, but neither of us are sure of our explanations.
 A: The question you ask is specifically about two sets $A$ and $B$. Draw a general Venn diagram with a universe $U$ (the usual rectangle), and two intersecting sets $A$ and $B$, say disks. The Venn Diagram divides the universe into $4$ parts. The only subsets we can make using the allowed tools are a union of $0$ or more of these parts. By listing, we can see that there are $16$ such subsets. 
But what about if we start with $3$ sets, $A$, $B$, and $C$? We go directly to the general case, where instead of starting with $2$ sets $A$ and $B$, we start with $n$ sets $A_1, A_2,\dots,A_n$. I believe you were solving the general case, without explicitly saying so. If that is so, the answer you got is correct.
Let the $A_i$ be subsets of a "universe" $U$.
Imagine drawing the associated Venn Diagram. The diagram divides the universe  into pairwise disjoint parts. 
These parts are obtained by looking successively at $A_1$, $A_2$, $A_3$, and so on, and saying yes or no. There are $2^n$ ways to do this. For some choices of $A_1$ to $A_n$, some of the resulting sets will be empty. But (if our universe is large enough) we can find $A_i$ such that each of the $2^n$ subsets we obtain in this way is non-empty.  Then the number of sets that can be constructed using allowed tools is as large as possible. 
The $2^n$ parts of the Venn Diagram are the "atoms" from which our subsets are constructed by union. We cannot split $U$ into finer parts than these atoms by using a combination of allowed operations.
Now we can build all the achievable subsets by saying yes or no to each atom, and taking the union of the atoms we say yes to.  If we have the full number $2^n$ of atoms, the number of ways to do this is $2^{(2^n)}$.
If $U$ is large enough, then by appropriate choice of the $A_i$ we can arrange to have exactly $k$ atoms, where $k$ is any number between $0$ and $2^n$. If we have $k$ atoms, then $2^k$ subsets can be constructed using allowed tools.
