In $"MgSO"_4$, the number of oxygen atoms is represented by the subscript directly next to the $"O"$.
In $"7H"_2"O"$, the coefficient $7$ can be multiplied throughout each element in the molecule.
$"MgS"color(red)("O"_4)rarr"4 O atoms"$
$color(red)("7")"H"_2color(red)("O")rarr"7 O atoms"$
There is a total of $4+7=11$ oxygen atoms.