n = int(input())
X = list(map(int, input().split()))
mean_L = sum(X)//n
mean_R = mean_L+1
ans = min(sum(map(lambda x: (x-mean_L)**2, X)),
          sum(map(lambda x: (x-mean_R)**2, X)))
print(ans) 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 mean_L = sum(X)//n mean_L sum(X)//n sum(X) sum X n mean_R = mean_L+1 mean_R mean_L+1 mean_L 1 ans = min(sum(map(lambda x: (x-mean_L)**2, X)),
          sum(map(lambda x: (x-mean_R)**2, X))) ans min(sum(map(lambda x: (x-mean_L)**2, X)),
          sum(map(lambda x: (x-mean_R)**2, X))) min sum(map(lambda x: (x-mean_L)**2, X)) sum map(lambda x: (x-mean_L)**2, X) map lambda x: (x-mean_L)**2 (x-mean_L)**2 x-mean_L x mean_L 2 x X sum(map(lambda x: (x-mean_R)**2, X)) sum map(lambda x: (x-mean_R)**2, X) map lambda x: (x-mean_R)**2 (x-mean_R)**2 x-mean_R x mean_R 2 x X print(ans) print ans mean_R = mean_L+1 mean_L+1 mean_R ans = min(sum(map(lambda x: (x-mean_L)**2, X)),
          sum(map(lambda x: (x-mean_R)**2, X))) min(sum(map(lambda x: (x-mean_L)**2, X)),
          sum(map(lambda x: (x-mean_R)**2, X))) ans mean_L = sum(X)//n sum(X)//n mean_L n = int(input()) int(input()) n X = list(map(int, input().split())) list(map(int, input().split())) X
n = int(input())
X = list(map(int, input().split()))
mean_L = sum(X)//n
mean_R = mean_L+1
ans = min(sum(map(lambda x: (x-mean_L)**2, X)),
          sum(map(lambda x: (x-mean_R)**2, X)))
print(ans)
