Atoms or ions with unpaired electrons are attracted to a magnetic field; the more unpaired electrons, the greater is the attraction. Such substances are called paramagnetic. Molecular oxygen is a paramagnetic gas by virtue of its two unpaired electrons.