Four. Fronts and rears have different part numbers. Wire is different length, I presume.
Replace all four at once every 100k miles to make your life simpler. Mine on the 325it have 125k on them so I guess I should get around to doing that chore, but it has not thrown a code yet. I have been putting it off because it looks a lot tighter than my e36s, so I am not looking forward to it.
Replace them one at a time so you don't cross the wires.