Imports System
Class C
	Shared Function Main() As Integer

		Dim n As Integer = Integer.Parse(Console.ReadLine())
		Dim inputs() As String
		Dim data(n) As Integer
		inputs = Console.ReadLine().Split()
		For i As integer = 0 To n-1
			data(i) = Integer.Parse(inputs(i))
		Next

		Dim ans As Integer = -1
		For pos As Integer = 1 To 100
			Dim sum As Integer = 0
			For i As Integer = 0 To n-1
				sum += (data(i)-pos)*(data(i)-pos)
			Next i
			
			If ans = -1
				ans = sum
			Else
				If ans > sum
					ans = sum
				End If
			End If
		Next

		Console.WriteLine(ans)
		
		Return 0
	End Function
End Class
