You are actually miscounting, if you count the rests there are a total of 24 8th notes in that bar. The reason for that is that there are two independent voices, each with their own rests. @Edward mentioned this in his comment. Here is a slightly more detailed explanation:
There can be more than one voice, even several voices in one staff line. They are usually distinguished by stems in opposite directions. The bass clef is a single voice but the treble clef is two voices. Here is how they break down:
The top line (including the upper rests) is stems up. The pattern is 8th notes, rest-note-note (three 8th notes total) on each beat for all 4 beats.
The bottom line (including the lower rests) is stems down and is quarter note-8th rest (three 8th notes total) on each beat for all 4 beats.
The upper and lower lines add up to 12 each, thus 24 8th notes in the bar played by two separate voices.