sum of i from 1 to n^2