  We give a necessary condition for photon state transformations in linear
optical setups preserving the total number of photons. From an analysis of the
algebra describing the quantum evolution, we find a conserved quantity that
appears in all allowed optical transformations. We comment some examples and
numerical applications, with example code, and give three general no-go
results. These include (i) the impossibility of deterministic transformations
which redistribute the photons from one to two different modes, (ii) a proof
that it is impossible to generate a perfect Bell state in heralded schemes with
a separable input for any number of ancillary photons and modes and a fixed
herald and (iii) a restriction for the conversion between different types of
entanglement (converting GHZ to W states).
