The number of oxidation (o.n.) of an atom in a molecule
It's a fictional charge. It is as if the atom had completely grabbed the electrons of the bond where it is the most electronegative partner or lost the electrons of the bond where it is the least electronegative partner and its charge is then determined: It is the o.n.
If the two atoms are identical, we share the binding electrons.
 
Example:
Here, we have allocated $ 7 e^- $ to each atom $ O $ whereas in its → ; neutral Lewis structure he has only 6.
Its fictitious charge (its o.n.) is therefore -1
We assigned 0 $ e^- $ to each $ H $ atom while in its → neutral Lewis structure it has 1.
Its fictitious charge (its o.n.) is +1
The variatioo.n. the oxidation number
If the o.n. increases by n units, the species loses n $ e ^ - $
If the o.n. decreases by n units, the species receives n $ e ^- $
No need to consider atoms that are in similar positions or $ H $ atoms attached to another atom, for example: