Look at your periodic table. All of the elements would like to have the same electron configuration as a noble gas, because those are the stable electron configurations. For elements that are just one or two spaces to the left of the noble gases, they can do it by gaining one or two electrons. For elements that are on the far left side of the periodic table, they can do it by losing one or two electrons.
So if you take for example, Neon (atomic number 10), the element to the left of neon is fluorine, and if it gains one electron (F-), it has the same electron arrangement as neon. If you look at the far left of the table and down one row, you get sodium (atomic number eleven), which if it lost one electron (Na+) would have the same electron configuration as neon.
The atomic number is the number of protons an element has, as well as the number of electrons. To get the same electron arrangement as a noble gas, it merely needs to gain or lose the number of electrons that would give it the same number as the nearest noble gas.