Zero knowledge of two factor
Firstly, convince the verifier that $n$ is not a prime number. (Prime is in P)
Use Zero-Knowledge Proof to make sure that $n$ has no square factor (no $p^2|n$)

See this paper Practical zero-knowledge proofs: Giving hints and using deficiencies for details.
Showing that $n$ has exactly two factors: if not, the number of quadratic residues is roughly less than $1/8*n$. Verifier just randomly chooses a value y and ask prover to prove whether y is quadratic residue. 

If the probability is roughly $1/4$, then accept.
Verifier can't cheat since he can only compute the quadratic residue, and let the probability raise, but not decrease below $1/8$.