n = int(input())
x = [int(i) for i in input().split()]
hp = []

for p in range(min(x), max(x)+1):
    sum = 0
    for i in x:
        sum = sum + (i-p)**2 
    hp.append(sum)
    
print(min(hp)) n = int(input()) n int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i x = [int(i) for i in input().split()] x [int(i) for i in input().split()] hp = [] hp [] for p in range(min(x), max(x)+1):
    sum = 0
    for i in x:
        sum = sum + (i-p)**2 
    hp.append(sum)
     p range(min(x), max(x)+1) range min(x) min x max(x)+1 max(x) max x 1 sum = 0 sum 0 for i in x:
        sum = sum + (i-p)**2 
     i x sum = sum + (i-p)**2 sum sum + (i-p)**2 sum (i-p)**2 i-p i p 2 hp.append(sum) hp.append hp append sum print(min(hp)) print min(hp) min hp x = [int(i) for i in input().split()] [int(i) for i in input().split()] x sum = 0 0 sum sum = sum + (i-p)**2 sum + (i-p)**2 sum n = int(input()) int(input()) n hp = [] [] hp
n = int(input())
x = [int(i) for i in input().split()]
hp = []

for p in range(min(x), max(x)+1):
    sum = 0
    for i in x:
        sum = sum + (i-p)**2 
    hp.append(sum)
    
print(min(hp))