Calculate how many sequences AB, with A;B ∈ P(S) exist such that A ∩ B = ∅. Let $S = \{1,2, \cdots ,n\}$, and  $\mathcal{P}(S)$ be the power set of $2^n$ subsets of $S$.
$$\textrm{Calculate how many sequences AB with A,B} \in{\mathcal{P}(S)} \textrm{exists such that } A\cap{B}=\emptyset$$  if  $ A=(1,2) , B=3 $ then $(1,2)(3)\neq{}(3)(1,2)$
I tried with $n=2$ and $n=3$ and I got $9$ possibilities for $n=2$ and $27$ for $n=3$ but I don't see how to calculate it 

Let $\mathcal F$ denote the collection of functions $S\to\{0,1,2\}$. It is evident that $|\mathcal F|=3^n$
Let $\mathcal G:=\{\langle A,B\rangle\mid A,B\subseteq S\wedge A\cap B=\varnothing\}$.
Prescribe $f:\mathcal F\to\mathcal G$ by $f\mapsto\langle f^{-1}(\{1\}),f^{-1}(\{2\})\rangle$.
Prescribe $g:\mathcal G\to\mathcal F$ by $\langle A,B\rangle\mapsto 1_A+2.1_B$.
Then $f$ and $g$ are inverses of each other and we conclude that $|\mathcal G|=|\mathcal F|=3^n$.
