There are general rules for assigning oxidation states for elements in compounds, but the rules are quite ambiguous. You will have to just get used to the system.
Anything bonded to itself will alwasy be in an oxidation state of 0, for example H2, N2, O2 as well as pure elements like Fe Cu Li and the like.
Now for the one hard rule, F is always -1 (unless bonded to ...
This solution answers the question posed as well as gives detailed information on the rules associated with oxidization states for the entire periodic table.