This is because of the way that the electrons in an atom of iron behave. The electrons in an iron atom tend to have the ability to align themselves and face one toward one direction such that one side of the atom has high negative charge and the other side has a high positive charge. So then that atom will behave like a tiny magnet.
Now when many of these "tiny magnets" line up, their combined attraction creates the force known as magnetism.
Most other elements do not have this unique property that iron has and that is why they are not magnetic.
We need to find the restoring force of the spring. It can be calculated using Hooke's law as "the force on a spring varies directly with the distance that it is stretched".
F = 50 N
So, the restoring force of the spring is 50 N. Hence, this is the required solution.