Calculate the valence of Fe2O3 $$\ce{FeO}$$

Is called "Iron(II) oxide ".

$$\ce{Fe_2O_3}$$

Is called "Iron(III) oxide ".

The number in the parenthesis is "Valence" of the substance. Frankly, I don't know how to calculate such number. Can you explain to me, with this example, how come $\ce{FeO}$ has valence $2$ and the other one has valence $3$?

The only thing I know how to do is calculate the electron configurations of each element.

For Iron, it is $1s^22s^22p^63s^23p^64s^23d^6$.

For Oxygen, it is $1s^22s^22p^4$.

I am told that based on the electron configuration you can get the valence of each element. And then, you can calculate the valence of $\ce{FeO}$ and $\ce{Fe_2O_3}$. But how?



I made a question before Calculating valence of oxides, but it was wrongly formulated (they corrected me on the definition of Valence, but turns out what I actually need was how to calculate it), so I'm flagging it to be closed.



Edit The question How to get the valencies of elements? doesn't explain how to calculate the valence of a combination of two elements.
@Voldemort you learn the valencies rather than calculate them.  Valency is a fact of experiment whilst electron configuration gives an underlying explanation for the observations from experiment.

Iron has two different valencies (and oxidation states) which are a consequence of the stability of the electron configuration that remains when electrons are lost upon reaction.  So, iron can loose 2 electrons to leave a stable $\ce{Fe++}$ species; in your reaction those 2 electrons are gained by oxygen to give an anion that has 8 electrons in its outer shell which is a stable configuration.

Iron can also loose 3 electrons to leave a stable system and again, in your system, the electrons are picked up by the appropriate number of oxygen atoms to give oxygen anions that have 8 electrons in their outer shell.

If you look at the either side of the periodic table, say sodium reacting with a halogen, say chlorine (to give sodium chloride); you can see the 8 electron rule working.  But you're looking at a system where the iron is found in the middle of the periodic table and is a lot more difficult to predict when compared to the 8 electron rule.