From the periodic table:
molar mass of carbon = 12 gm
molar mass of hydrogen = 1 gm
molar mass of oxygen = 16 gm
molar mass of acetylsalicylic acid = 9(12) + 8(1) + 4(16) = 180 gm
Number of moles = mass / molar mass = 0.5 / 180 = 2.778 x 10^-3 moles
To get the number of molecules, we multiply the number of moles by Avogadro's number as follows:
number of molecules = 2.778x10^-3x6.02x10^23 =1.672 x 10^21 molecules