He had 48 marbles.
Taking marbles in 6s, here's how to fill the mugs:
6 marbles in 1st mug
2 more marbles in 1st mug to fill it, then 4 in 2nd mug
Another 4 in 2nd mug to fill it, then 2 in 3rd mug
Next 6 marbles in 3rd mug to fill it. (4 lots of 6 (24) marbles used to fill 3 mugs (3×8))
6 marbles in 4th mug
2 more marbles in 4th mug to fill it, then 4 in 5th mug
Another 4 in 5th mug to fill it, then 2 in 6th mug
6 marbles in 6th mug to fill it. (Another 4 lots of 6 (24) marbles used to fill another 3 mugs (3×8))
[6+(2+4)+(4+2)+6]+[6+(2+4)+(4+2)+6] =[6+6+6+6]+[6+6+6+6]=24+24=48 marbles
3 mugs + 3 mugs = 6 mugs
[(6+2)+(4+4)+(2+6)]+[(6+2)+(4+4)+(2+6)]=[8+8+8]+[8+8+8]=24+24=48 marbles