Solution (source code)

= Solution

Write $K=\mathbb Q(\alpha)$ with minimal polynomial of degree $n$. An embedding is determined by the image of $\alpha$, and each of the $n$ distinct complex roots gives one embedding, so there are exactly $n$.

For an integral basis $\omega_1,\ldots,\omega_n$, the field discriminant is
$$
d_K=\det(\sigma_i(\omega_j))^2.
$$
Order the embeddings with all real embeddings first and each nonreal embedding adjacent to its conjugate. Replacing each conjugate pair of rows by their real and imaginary parts extracts one factor $2i$ from the determinant. The remaining determinant is real and nonzero. Squaring shows
$$
\boxed{\operatorname{sgn}(d_K)=(-1)^s},
$$
where $s$ is the number of conjugate pairs.