n = int(input())
*x, = map(int, input().split())
ans = float('inf')
for i in range(min(x), max(x)+1):
    tmp = 0
    for j in x:
        tmp += (j - i)*(j - i)
    ans = min(ans, tmp)
print(ans) n = int(input()) n int(input()) int input() input *x, = map(int, input().split()) *x x map(int, input().split()) map int input().split() ().split () input split ans = float('inf') ans float('inf') float 'inf' for i in range(min(x), max(x)+1):
    tmp = 0
    for j in x:
        tmp += (j - i)*(j - i)
    ans = min(ans, tmp) i range(min(x), max(x)+1) range min(x) min x max(x)+1 max(x) max x 1 tmp = 0 tmp 0 for j in x:
        tmp += (j - i)*(j - i)
     j x tmp += (j - i)*(j - i) tmp (j - i)*(j - i) j - i j i j - i j i ans = min(ans, tmp) ans min(ans, tmp) min ans tmp print(ans) print ans n = int(input()) int(input()) n ans = float('inf') float('inf') ans tmp += (j - i)*(j - i) (j - i)*(j - i) tmp ans = min(ans, tmp) min(ans, tmp) ans tmp = 0 0 tmp
n = int(input())
*x, = map(int, input().split())
ans = float('inf')
for i in range(min(x), max(x)+1):
    tmp = 0
    for j in x:
        tmp += (j - i)*(j - i)
    ans = min(ans, tmp)
print(ans)