How do I calculate the number of atoms in a compound (not an element)?

I have the mass of the amount of substance, and the molar masses. How do I do this? Is this the same as calculating the number of molecules/ formula units? Also, I know the number of atoms for each element in the compound (It made me calculate that before)

See your post above.