A simple proof of Stolarsky’s invariance principle