N = int(input())
X = tuple(map(int, input().split()))
ans = 10 ** 7
for p in range(min(X), max(X) + 1):
    total = 0
    for x in X:
        total += (x - p) ** 2
    ans = min(ans, total)
print(ans) N = int(input()) N int(input()) int input() input X = tuple(map(int, input().split())) X tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split ans = 10 ** 7 ans 10 ** 7 10 7 for p in range(min(X), max(X) + 1):
    total = 0
    for x in X:
        total += (x - p) ** 2
    ans = min(ans, total) p range(min(X), max(X) + 1) range min(X) min X max(X) + 1 max(X) max X 1 total = 0 total 0 for x in X:
        total += (x - p) ** 2
     x X total += (x - p) ** 2 total (x - p) ** 2 x - p x p 2 ans = min(ans, total) ans min(ans, total) min ans total print(ans) print ans ans = min(ans, total) min(ans, total) ans X = tuple(map(int, input().split())) tuple(map(int, input().split())) X N = int(input()) int(input()) N total = 0 0 total ans = 10 ** 7 10 ** 7 ans total += (x - p) ** 2 (x - p) ** 2 total
N = int(input())
X = tuple(map(int, input().split()))
ans = 10 ** 7
for p in range(min(X), max(X) + 1):
    total = 0
    for x in X:
        total += (x - p) ** 2
    ans = min(ans, total)
print(ans)