Pyramid $OABCD$ has square base $ABCD$, congruent edges $\overline{OA},\overline{OB},\overline{OC},$ and $\overline{OD}$, and $\angle AOB=45^\circ$. Let $\theta$ be the measure of the dihedral angle formed by faces $OAB$ and $OBC$. Given that $\cos\theta=m+\sqrt{n}$, where $m$ and $n$ are integers, find $m+n$.