$\newcommand{\ket}[1]{\left|#1\right>}$ A Mach-zahnder interferometer with $\ket{\alpha}$ input in port A and $\ket{0}$ in port B gives an intensity difference in the two detectors after the second beam splitter as $|\alpha|^2\cos{\phi}$ where $\phi$ is the phase difference between the two interfering rays coming from the arms of the interferometer. This dependence on $\cos{\phi}$ is improved to $N\cos{N\phi}$ if the N00N state is used. Where
$ \ket{N00N} = \frac{\ket{N}_C\ket{0}_D + \ket{0}_C\ket{N}_D}{\sqrt{2}} $
and $\ket{N}$ is a fock state, or a number state of light, and $\ket{\alpha}$ is the coherent state.
Now, as I understand, the N00N state should exist between the arms of the interferometer, that is, after the first beam splitter, if there are N photons in the arm D, there are none in arm C, and vice versa. When working with $N=2$, after going through a phase shift $\phi$ in arm D such that $\ket{N} \xrightarrow{\phi} e^{-iN\phi}\ket{N}$ and then through the second beam splitter, I am getting the output state
$\ket{\psi_{out}} = \frac{i\sqrt{2}(1-e^{-2i\phi})\ket{2}_{D2}\ket{0}_{D1}}{4} - \frac{(1+e^{-2i\phi})\ket{1}_{D2}\ket{1}_{D1}}{2} - \frac{i\sqrt{2}(1-e^{-2i\phi})\ket{0}_{D2}\ket{2}_{D1}}{4}$.
From this, I am getting $\left<I\right> = \left<I_{D1}-I_{D2}\right> = 0$. where $I$ for the detectors are the number operators at those detectors. Can someone please tell me where people are getting the dependence of $\cos{2\phi}$ from? Am I wrong conceptually somewhere? Are they measureing some other operator? The case for $N=2$ will be fine. Thanks.
PS: The beam splitter transformations are:-
$\hat{a}_{A}\rightarrow\frac{\hat{a}_C-i\hat{a}_D}{\sqrt{2}}$ , $\hat{a}_{B}\rightarrow\frac{-i\hat{a}_C+\hat{a}_D}{\sqrt{2}}$
and
$\hat{a}_{C}\rightarrow\frac{\hat{a}_{D2}-i\hat{a}_{D1}}{\sqrt{2}}$ , $\hat{a}_{D}\rightarrow\frac{-i\hat{a}_{D2}+\hat{a}_{D1}}{\sqrt{2}}$
where $\hat{a}$ is the general annihilation operator for the number state.