The phase-dependent bound states (Andreev levels) of a Josephson junction can cross at the Fermi level, if the superconducting ground state switches between even and odd fermion parity. The level crossing is topologically protected, in the absence of time-reversal and spin-rotation symmetry, irrespective of whether the superconductor itself is topologically trivial or not. We develop a statistical theory of these topological transitions in an N-mode quantum-dot Josephson junction, by associating the Andreev level crossings with the real eigenvalues of a random non-Hermitian matrix. The number of topological transitions in a 2pi phase interval scales as sqrt(N) and their spacing distribution is a hybrid of the Wigner and Poisson distributions of random-matrix theory.