WARNING: This page is about a different car, the 2011 Subaru Tribeca. However, it is still accessible from the selected car via links, so may be relevant.
Install in the reverse order of removal.
NOTE:
Connect the "P" range switch terminal to connector.
Fig 1: Identifying P Range Switch Connector Terminals