Assigning oxidation states to compounds or ions