Iron is a transition metal. It has two valence states of II and III. You see here that you have four oxygens which means that 8 valance electrons are in use. Hang on to your hat here.
Fe3O4
You see that you have 3 irons. This is the kicker.
Two of those irons are iron (III), which gives 6 valance electrons, the other Iron is Iron(II), which has 2 valence electrons for a total of 8 valence electrons matching the 4 oxygen, which total 8 valence electrons!