There is a mismatch in the brackets in your formula. But anyway: If you raise a square root to power 2 this gives that which is in / under the square root, so

sqrt ((Xi - Mean(X))^2/(n-2)) raised to power 2 is (Xi-Mean(X))^2/(n-2).

sqrt ((Xi - Mean(X))^2/(n-2)) raised to power 2 is (Xi-Mean(X))^2/(n-2).