import statistics

N = int(input())
X = list(map(int,input().split()))
P = round( statistics.mean(X) )

ans = sum([(i-P)**2 for i in X])
print(ans) import statistics statistics N = int(input()) N int(input()) int input() input X = list(map(int,input().split())) X list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split P = round( statistics.mean(X) ) P round( statistics.mean(X) ) round statistics.mean(X) statistics.mean statistics mean X (i-P)**2 for i in X for i in X i X for i in X (i-P)**2 i-P i P 2 ans = sum([(i-P)**2 for i in X]) ans sum([(i-P)**2 for i in X]) sum [(i-P)**2 for i in X] print(ans) print ans ans = sum([(i-P)**2 for i in X]) sum([(i-P)**2 for i in X]) ans X = list(map(int,input().split())) list(map(int,input().split())) X P = round( statistics.mean(X) ) round( statistics.mean(X) ) P N = int(input()) int(input()) N
import statistics

N = int(input())
X = list(map(int,input().split()))
P = round( statistics.mean(X) )

ans = sum([(i-P)**2 for i in X])
print(ans)