Imports System

Module Program
    Sub Main(args As String())
        Dim N As Long = Console.ReadLine()
        Dim tmpX As String() = Split(Console.ReadLine(), " ")

        Dim X As Long = 0

        For i = 0 To N - 1
            X = X + CLng(tmpX(i))
        Next

        Dim ave As Long = X / N
        Dim ans As Long = 0

        For i = 0 To N - 1
            ans = ans + (CLng(tmpX(i)) - ave) ^ 2
        Next

        Console.WriteLine(ans)
    End Sub
End Module


