N = int(input())
numbers = list(map(int, input().split()))

P = round(sum(numbers)/N)

sum = 0
for i in range(N):
  sum += (numbers[i] - P)**2

print(sum) N = int(input()) N int(input()) int input() input numbers = list(map(int, input().split())) numbers list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split P = round(sum(numbers)/N) P round(sum(numbers)/N) round sum(numbers)/N sum(numbers) sum numbers N sum = 0 sum 0 for i in range(N):
  sum += (numbers[i] - P)**2 i range(N) range N sum += (numbers[i] - P)**2 sum (numbers[i] - P)**2 numbers[i] - P numbers[i] numbers i P 2 print(sum) print sum N = int(input()) int(input()) N numbers = list(map(int, input().split())) list(map(int, input().split())) numbers sum = 0 0 sum P = round(sum(numbers)/N) round(sum(numbers)/N) P sum += (numbers[i] - P)**2 (numbers[i] - P)**2 sum
N = int(input())
numbers = list(map(int, input().split()))

P = round(sum(numbers)/N)

sum = 0
for i in range(N):
  sum += (numbers[i] - P)**2

print(sum)