The answer is: Dividing the number of molecules in the sample by Avogadro's number.
The Avogadro’s number is the number of atoms in 12 grams of the isotope carbon-12 (¹²C).
Na is Avogadro number or Avogadro constant (the number of particles, in this example carbon, that are contained in the amount of substance given by one mole).
The Avogadro number has value 6.022·10²³ 1/mol in the International System of Units; Na = 6.022·10²³ 1/mol.
For example:
N(Ba) = 2.62·10²³; number of atoms of barium.
n(Ba) = N(Ba) ÷ Na.
n(Ba) = 1.3·10²⁴ ÷ 6.022·10²³ 1/mol.
n(Ba) = 2.158 mol; amount of substance of barium.