We work out (i) a molar quantity, and then (ii) multiply this molar quantity by #N_A#, #"Avogadro's Number"#.
By definition in #18.01# #g# of water, #1# #mol# of water, there are #"Avogadro's Number"# of MOLECULES; and again in terms of #"Avogadro's Number"#, #N_A#, there are #N_A# #"O"# atoms and #2xxN_A# #"H"# atoms, there are also masses of #15.999*g# #O# and #2xx1.00794*g# #H#. I use #N_A# here as I would any other collective number, a dozen, or a gross, or bakers' dozen.
So in #0.050# #g# water, there are #(0.050*g)/(18.015*g*mol^-1)# #xxN_A#, #~~# #2.8xx10^-3# #xx# #N_A# water molecules.
From where did I get the elemental molar masses? Did I and do you have to remember them?