Determining oxidation numbers in compounds