What you need to do is to work out the number of moles of the substance you have, and then multiply the number of moles by Avagadros constant - as avagadros constant states that 1 mole of ANY substance will contain 6.0221415 × 10^23 atoms.
Oxygen is a slightly wierd example, as its a gas, so working out the number of moles is different than for solids, so you would need the volume and not the weight. But lets presume that this oxygen is in liquid form, then you would do;
0.3/16 = 0.01875 moles
0.01875*6.0221415 × 10^23 = 1.12915153 × 10^22
If you want to work out for another solid, then replace the 0.3 with the amount u have (in g) and replace the 16 with the atomic mass of that element (as 16 is the Mr of oxygen) and then times by avagadros constant (6.0221415 × 10^23).
For gases, to work out the moles, do the volume, in dm^3 (which is essentially litres), and divide it by 24, as 1mole of any gas occupies 24dm^3 . And then multiply by Avagadros constant.
P.S - You know the ^ symbol means 'To the power of' ?
Btw, i used google as a calculator so im not actually sure on the calculations, but Avagadros constant is correct .
Hope I helped mate, and dont quote me cos i may be wrong, but i hope not aha.