We know that
E = hν
Where
E = energy of one photon
h = Planck's constant = 6.626x10^-34 J s
ν = frequency
the relation between frequency and wavelength and speed of light is
ν = c / λ
Where c = speed of light = 3.00x10^8 m/s
λ = wavelength = 508 nm = 508 X 10^-9 m
Putting values to get energy of each photon
E = hc / λ = (6.626x10^-34 J s) x (3.00x10^8 m/s) / 508x10^-9 m = 3.91 X 10^19 J
Number of photons = energy given / energy of each photon
Number of photons = 0.366 J / 3.91 X 10^19 J = 9.36 X 10^17