#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
#mod = 10**9 + 7
#mod = 9982443453
mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
ans = float('inf')
for i in range(1,101):
    diff = 0
    for j in range(n):
        diff += pow(A[j]-i,2)
    ans = min(ans,diff)
print(ans) from fractions import gcd from itertools import combinations,permutations,accumulate, product from collections import deque,defaultdict,Counter import decimal decimal import re re import math math import sys sys sys.setrecursionlimit(10000000) sys.setrecursionlimit sys setrecursionlimit 10000000 mod = 998244353 mod 998244353 def readInts():
  return list(map(int,input().split())) readInts return list(map(int,input().split())) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split def I():
  return int(input())
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] I return int(input()) int(input()) int input() input from fractions import gcd from itertools import combinations,permutations,accumulate, product from collections import deque,defaultdict,Counter import decimal decimal import re re import math math import sys sys sys.setrecursionlimit(10000000) sys.setrecursionlimit sys setrecursionlimit 10000000 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 def readInts():
  return list(map(int,input().split())) readInts return list(map(int,input().split())) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split def I():
  return int(input()) I return int(input()) int(input()) int input() input n = I() n I() I A = readInts() A readInts() readInts ans = float('inf') ans float('inf') float 'inf' for i in range(1,101):
    diff = 0
    for j in range(n):
        diff += pow(A[j]-i,2)
    ans = min(ans,diff) i range(1,101) range 1 101 diff = 0 diff 0 for j in range(n):
        diff += pow(A[j]-i,2)
     j range(n) range n diff += pow(A[j]-i,2) diff pow(A[j]-i,2) pow A[j]-i A[j] A j i 2 ans = min(ans,diff) ans min(ans,diff) min ans diff print(ans) print ans n = I() I() n ans = min(ans,diff) min(ans,diff) ans ans = float('inf') float('inf') ans mod = 998244353 998244353 mod mod = 10**9 + 7 10**9 + 7 mod diff += pow(A[j]-i,2) pow(A[j]-i,2) diff def readInts():
  return list(map(int,input().split())) def readInts():
  return list(map(int,input().split())) readInts A = readInts() readInts() A diff = 0 0 diff def readInts():
  return list(map(int,input().split())) def readInts():
  return list(map(int,input().split())) readInts def I():
  return int(input()) def I():
  return int(input()) I def I():
  return int(input())
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] def I():
  return int(input())
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] I
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
#mod = 10**9 + 7
#mod = 9982443453
mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
ans = float('inf')
for i in range(1,101):
    diff = 0
    for j in range(n):
        diff += pow(A[j]-i,2)
    ans = min(ans,diff)
print(ans)
