Can anyone detail the steps to help me understand why:

Sum( (Xi - X-bar)^2 )/n (where the sum is 1 to n)

equals

(Sum ( (Xi)^2) - n*x-bar^2) / n where the summation is 1 to n.

I know this must be simple algebra but I cant seem to see it!

Any help with the logic/steps is appreciated

Thanks!