Counterexample:
$\left(\begin{array}{ccc} 1 & 0 & 1 \\\\ 0 & 1 & 1 \\\\ 1 & 1 & \sqrt3 \end{array}\right)$$B=\left(\begin{array}{ccc} 1 & 0 & 1 \\\\ 0 & 1 & 1 \\\\ 1 & 1 & \sqrt3 \end{array}\right)$.
This is for $n=3$, and easily extends to all $n\geq 3$.
For $n=2$ it holds, though.