Second harmonic generation from a collection of nanoparticles