The first time you encounter quantum mechanics, it might seem very odd that the universe operates via discrete packets of energy. How can an electron know what an integer is?
But a guitar also knows what an integer is. A string of fixed length L can oscillate with a wavelength of 2L, L, 2L/3, L/2, ... , 2L/n, where n is an integer. It's all harmonics; oscillating modes.