Sum[(n - i + 1) (2 i - 1), {i, 1, n}]