The sum of oxidation numbers for a charged compound has to be equal to the charge on the compound.
This is because, the sum of oxidation numbers represent the charge of a compound itself.
For neutral compounds this sum is 0, for charged compounds it is the charge of the compound.