solution to Inverting Parity.