N = int(input()) X = list(map(int, input().split())) costs = [] # 最後に最小値を取りたいので、結果を溜めておくリストを作成 for j in range(1,101): cost = 0# 各ループごとに初期化する for x in X: cost += (x-j)**2# i番目の人が座標jで集会に参加するコストを、costに足しこむ costs.append(cost) # リストに追加 print (min(costs)) # 最小値を出力