import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools

def main():
    n = int(input())
    l = list(map(int, input().split()))
    ans = INF
    for i in range(1,101):
        trial = 0
        for k in l:
            trial += (k-i)**2
        ans = min(ans, trial)
    print(ans)

if __name__=="__main__":
    main() import math math from math import gcd INF = float("inf") INF float("inf") float "inf" import sys sys input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline import itertools itertools def main():
    n = int(input())
    l = list(map(int, input().split()))
    ans = INF
    for i in range(1,101):
        trial = 0
        for k in l:
            trial += (k-i)**2
        ans = min(ans, trial)
    print(ans) main n = int(input()) n int(input()) int input() input l = list(map(int, input().split())) l list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = INF ans INF for i in range(1,101):
        trial = 0
        for k in l:
            trial += (k-i)**2
        ans = min(ans, trial)
     i range(1,101) range 1 101 trial = 0 trial 0 for k in l:
            trial += (k-i)**2
         k l trial += (k-i)**2 trial (k-i)**2 k-i k i 2 ans = min(ans, trial) ans min(ans, trial) min ans trial print(ans) print ans if __name__=="__main__":
    main() __name__=="__main__" __name__ "__main__" main() main def main():
    n = int(input())
    l = list(map(int, input().split()))
    ans = INF
    for i in range(1,101):
        trial = 0
        for k in l:
            trial += (k-i)**2
        ans = min(ans, trial)
    print(ans) def main():
    n = int(input())
    l = list(map(int, input().split()))
    ans = INF
    for i in range(1,101):
        trial = 0
        for k in l:
            trial += (k-i)**2
        ans = min(ans, trial)
    print(ans) main input=sys.stdin.readline sys.stdin.readline input INF = float("inf") float("inf") INF
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools

def main():
    n = int(input())
    l = list(map(int, input().split()))
    ans = INF
    for i in range(1,101):
        trial = 0
        for k in l:
            trial += (k-i)**2
        ans = min(ans, trial)
    print(ans)

if __name__=="__main__":
    main()
