Quantum states of magnetic nanostructures