Complete reaction of acetaldehyde with excess formaldehyde, upon heating with conc. NaOH solution, gives $\mathbf{P}$ and $\mathbf{Q}$. Compound $\mathbf{P}$ does not give Tollens' test, whereas $\mathbf{Q}$ on acidification gives positive Tollens' test. Treatment of $P$ with excess cyclohexanone in the presence of catalytic amount of $p$-toluenesulfonic acid (PTSA) gives product $R$.
Sum of the number of methylene groups ( $-\mathrm{CH}_2-$ ) and oxygen atoms in $\mathbf{R}$ is $\_\_\_\_$ .