Calculating MSD

Wasn't that easy?