Photons do not interact directly with each other, but conditional control of one beam by another can be achieved with non-linear optical media at high field intensities. It is exceedingly difficult to reach such intensities at the single photon level but proposals have been made to obtain effective interactions by scattering photons from single transitions. We report here effective interactions between photons created using a quantum dot weakly coupled to a cavity. We show that a passive single-photon non-linearity can modify the counting statistics of a Poissonian beam, sorting the photons in number. This is used to create strong correlations between detection events and sort polarisation correlated photons from an uncorrelated stream using a single spin. These results pave the way for optical switches operated by single quanta of light.