Correlation function of wavepacket with sharp number of photons