#include<bits/stdc++.h>
using namespace std;
#define ll long long int
typedef unsigned long long int ull;
typedef long double ldb;
#define B 1000000007
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repi(i,a,b) for(ll i=b-1;i>=a;i--)
#define MT make_tuple
#define G(a,b) get<a>(b)
#define VI vector<int>
#define VLL vector<long long int>
#define pb push_back
#define mp make_pair
#define ani ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit
4)(a^b) = (a|b)-(a&b) = (a+b-2*(a&b))
5)(a+b) = a^b + 2*(a&b)
6)   lowest set bit of N =n ^ ( n & (n-1));
7)    Turn off 1st set bit= n^(n&(-n));
8) clear all bits from MSB to ith bit  = n&((1<<i)-1);    
9) clear all bits from LSB= n&(~((1<<(i+1))-1))      
10) if a%m<0 then compute (a%m+m)%m    
11) int __builtin_ffs (int x) Returns one plus the index of the least significant 1-bit of x, or if x is zero, returns zero. 
12) int __builtin_clz (unsigned int x)  Returns the number of leading 0-bits in x, starting at the most significant bit position. If x is 0, the result is undefined.
13)  int __builtin_ctz (unsigned int x)    Returns the number of trailing 0-bits in x, starting at the least significant bit position. If x is 0, the result is undefined.
14)   __builtin_popcountl()
15)  __builtin_parityl()  Returns the parity of x, i.e. the number of 1-bits in x modulo 2.
16) __builtin_ctz(x) returns number of trailing 0-bits of x which starts from least significant bit position if x == 0, returns an undefined value.
 17)  for any two relatively prime positive integers m,nm,n, the greatest integer that cannot be written in the form am + bnam+bn for nonnegative integers a, ba,b is \ mn-m-n mn−m−n  */



#define endl "\n"


ll gcd(ll  a, ll  b) { 
   if (b == 0) 
      return a; 
   return gcd(b, a % b);  
} 
 
ll lcm(ll a, ll b){ 
    return (a*b)/(gcd(a, b));
}
ll max(ll a, ll b){
  if (a > b)
    return a;
  return b;
}

 
int binarySearch(int arr[], int l, int r, int x) 
{ 
    if (r >= l) { 
        int mid = l + (r - l) / 2; 
  
        // If the element is present at the middle 
        // itself 
        if (arr[mid] == x) 
            return mid; 
  
        // If element is smaller than mid, then 
        // it can only be present in left subarray 
        if (arr[mid] > x) 
            return binarySearch(arr, l, mid - 1, x); 
  
        // Else the element can only be present 
        // in right subarray 
        return binarySearch(arr, mid + 1, r, x); 
    } 
  
    // We reach here when element is not 
    // present in array 
    return -1; 
} 
 
ll nCr(ll n,ll k){ 
    ll C[n + 1][k + 1]; 
    ll i, j; 
    for (i=0;i<=n;i++){ 
        for(j=0;j<=min(i,k);j++){
            if(j==0||j==i) 
                C[i][j]=1;  
            else
                C[i][j]=C[i-1][j-1]+C[i-1][j]; 
        } 
    }
    return C[n][k]; 
} 
 
 
 ll decimalToBinary(ll N) 
{ 
  
    // To store the binary number 
    ll B_Number = 0; 
    ll cnt = 0; 
    while (N != 0) { 
        ll rem = N % 2; 
        ll c = pow(10, cnt); 
        B_Number += rem * c; 
        N /= 2; 
  
        // Count used to store exponent value 
        cnt++; 
    } 
  
    return B_Number; 
} 

std::vector<int> v;
int countFreq(string &pat, string &txt) 
{ 
    int M = pat.length(); 
    int N = txt.length(); 
    int res = 0; 
    
    /* A loop to slide pat[] one by one */
    for (int i = 0; i <= N - M; i++) 
    {  
        /* For current index i, check for  
           pattern match */
        int j; 
        for (j = 0; j < M; j++) 
            if (txt[i+j] != pat[j]) 
                break; 
   
        // if pat[0...M-1] = txt[i, i+1, ...i+M-1] 
        if (j == M)   
        {  v.pb(i);
           res++; 
           j = 0; 
        } 
    } 
    return res; 
} 


int lis(int a[],int n)
{
    int b[n];
    b[0]=1;
    for (int i = 1; i < n; ++i)
    {
        b[i]=1;
    for(int j=i-1;j>=0;j--)
    {
        if(a[j]>a[i])
            continue;
        int p=b[j]+1;
        if(p>a[i])
            a[i]=p;
    }
    }
    int best=0;
    for (int i = 0; i < n; i++) {
        if (best < b[i]) {
            best = b[i];
        }
    }
return best;
}



int count_ways_to_make_change(int s[],int m,int n)
{
    int i,j,x,y;
    int table[n+1][m];

for( i=0;i<m;i++)
{ table[0][i]=1;
}

for(i=1;i<n+1;i++)
{
    for(j=0;j<m;j++)
    {
        x=(i-s[j]>=0)?table[i-s[j]][j]:0; //count of sols including s[j]
        y=(j>=1)?table[i][j-1]:0; // count of sols excluding s[j]

        table[i][j]=x+y;  //total count
    }

}
return table[n][m-1];

}


ll kadane(ll a[],ll n)
{
    ll curr=0;
    ll best=0;
    for(ll i=0;i<n;i++)
    {
        curr+=a[i];
        if(best<curr)
        {
            best=curr;
        }
        if(curr<0)
            curr=0;
    }
    return best;
}

string decToBin(ll n) 
{ 
    if (n == 0) 
        return "0"; 
      
    // to store the binary equivalent of decimal 
    string bin = "";     
    while (n > 0)     
    { 
        // to get the last binary digit of the number 'n' 
        // and accumulate it at the beginning of 'bin' 
        bin = ((n & 1) == 0 ? '0' : '1') + bin; 
          
        // right shift 'n' by 1 
        n >>= 1; 
    } 
      
    // required binary number 
    return bin; 
} 
  

  ll binaryToDecimal(string n) 
{ 
    string num = n; 
    ll dec_value = 0; 
  
    // Initializing base value to 1, i.e 2^0 
    ll base = 1; 
  
    ll len = num.length(); 
    for (ll i = len - 1; i >= 0; i--) { 
        if (num[i] == '1') 
            dec_value += base; 
        base = base * 2; 
    } 
  
    return dec_value; 
} 



ll countDivisors(ll n) 
{ 
    ll cnt = 0; 
    for (ll i = 1; i <= sqrt(n); i++) 
    { 
        if (n % i == 0) 
        { 
            // If divisors are equal, 
            // count only one 
            if (n / i == i) 
                cnt++; 
  
            else // Otherwise count both 
                cnt = cnt + 2; 
        } 
    } 
    return cnt; 
} 



vector<ll> factors(ll n) {
        vector<ll> f;
        for (ll x = 2; x*x <= n; x++) {
           while (n%x == 0) {
f.push_back(x);
n /= x; }
}
if (n > 1) f.push_back(n); return f;
}

ll inv[32][2];
void solve(int bit,vector<int> v){
    if(bit == -1 || v.empty()) return;
    int z=0,o=0;
    vector<int> v1;
    vector<int> v2;
    for(int i=0;i<v.size();++i){
        if(v[i] & (1<<bit)){
            ++o;
            inv[bit][1] += z;
            v1.push_back(v[i]);
        }
        else{
            ++z;
            inv[bit][0] += o;
            v2.push_back(v[i]);
        }
    }
    solve(bit-1,v1);
    solve(bit-1,v2);
}





int main()
{ 
ani;
    
int t=1;
//cin>>t;
while(t--)
{
  int n;
  cin>>n;
  int x[n+1];
  for(int i=1;i<=n;i++)
  {
    cin>>x[i];
  }

ll maxi=B;
  for(int i=1;i<=100;i++)
  {
    ll s=0;
    for(int j=1;j<=n;j++)
    {
        if(i!=x[j])
            s+=(i-x[j])*(i-x[j]);
    }
    maxi=min(maxi,s);
  }

 
cout<<maxi;























}



























return 0;
}

Measured memory_bytes: 256