This is because the discrete energy levels don’t like to share the exact same energy levels as neighbors (Pauli exclusion principle).
For single atoms, the energy levels are exactly defined by the Schrödinger equation:)