Rules for Assigning Oxidation Numbers
Rules 3 & 4
3. The oxidation number of oxygen in   
compounds is -2
4. The oxidation number of hydrogen in compounds is +1