#include <bits/stdc++.h>
#if 1
    #define for_in(x,X) for(auto& x: X)
    #define rep(i,count) for(size_t i=0; i<count; ++i)
    #define for_range(i,begin,end) for(size_t i=begin; i<end; ++i)

    using namespace std;
    typedef unsigned int uint; typedef unsigned char u8; typedef unsigned short u16; typedef unsigned int u32; typedef unsigned long u64;
    typedef char s8; typedef short s16; typedef int s32; typedef long s64; typedef float f32; typedef double f64;
    typedef vector<int> v_int; typedef vector<uint> v_uint; typedef vector<u32> v_u32; typedef vector<s32> v_s32; 
    typedef vector<u64> v_u64; typedef vector<s64> v_s64; typedef vector<bool> v_bool; typedef vector<string> v_string;

    inline void init(){cin.tie(0);ios::sync_with_stdio(false);}
    inline char ctoi(char a){return a-'0';}
    struct input_returnner { template<typename T>operator T() const { T t; cin >> t;   return t;} };
    input_returnner inline input() { return input_returnner(); }
    void print(){cout<<"\n";}
    template<class Head, class... Tail> void print(Head&& first, Tail&&... rest){cout<<first;if(sizeof...(rest)!= 0)cout<<' ';print(forward<Tail>(rest)...);}
    template<class T> string str(T x){stringstream ss;ss<<x;return ss.str();}

    u64 pow_int(u32 x, u32 n){u32 res=1; while(n>0){if(n&0b1)res*=x;x=x*x;n>>=1;} return res;}
    s64 pow_int(s32 x, u32 n){s32 res=1; while(n>0){if(n&0b1)res*=x;x=x*x;n>>=1;} return res;}
    u64 pow_int(u64 x, u32 n){u64 res=1; while(n>0){if(n&0b1)res*=x;x=x*x;n>>=1;} return res;}
    s64 pow_int(s64 x, u32 n){s64 res=1; while(n>0){if(n&0b1)res*=x;x=x*x;n>>=1;} return res;}

    template <class T> class has_iterator{
    template <class U> static constexpr bool check(typename U::iterator*){return true;}
    template <class U> static constexpr bool check(...){return false;}
    public: static constexpr bool value = check<T>(nullptr); };

    template<class T, typename std::enable_if<has_iterator<T>::value, std::nullptr_t>::type = nullptr> inline typename T::value_type max(const T &x){return *max_element(x.begin(), x.end());}
    template<class T, typename std::enable_if<has_iterator<T>::value, std::nullptr_t>::type = nullptr> inline typename T::value_type min(const T &x){return *min_element(x.begin(), x.end());}
    template<class T, typename std::enable_if<has_iterator<T>::value, std::nullptr_t>::type = nullptr> inline size_t argmax(const T &x){auto it = max_element(x.begin(), x.end()); return distance(x.begin(), it);}
    template<class T, typename std::enable_if<has_iterator<T>::value, std::nullptr_t>::type = nullptr> inline size_t argmin(const T &x){auto it = min_element(x.begin(), x.end()); return distance(x.begin(), it);}
    template<class T, typename std::enable_if<has_iterator<T>::value, std::nullptr_t>::type = nullptr> inline typename T::value_type sum(const T &x){return accumulate(x.begin(), x.end(),0);}
    template<class T, typename std::enable_if<has_iterator<T>::value, std::nullptr_t>::type = nullptr> inline size_t get_idx(const T &x, typename T::value_type val){auto it=find(x.begin(),x.end(),val); return distance(x.begin(), it);}
    template<class T, typename std::enable_if<has_iterator<T>::value, std::nullptr_t>::type = nullptr> inline bool is_in(typename T::value_type val, const T &x){auto it=find(x.begin(),x.end(),val); return it!=x.end();}
    template<class T, typename std::enable_if<has_iterator<T>::value, std::nullptr_t>::type = nullptr> inline void sort(T &x){sort(x.begin(), x.end());}
    template<class T, typename std::enable_if<has_iterator<T>::value, std::nullptr_t>::type = nullptr> inline void rsort(T &x){sort(x.rbegin(), x.rend());}
    template<class T, typename std::enable_if<has_iterator<T>::value, std::nullptr_t>::type = nullptr> inline size_t len(const T &x){return x.size();}

    template<class T> inline T max(const set<T> &x){return *(--x.end());}
    template<class T> inline T min(const set<T> &x){return *(x.begin());}
    template<class T> inline bool is_in(T val, const set<T> &x){return x.count(val);}
    template<class T> inline bool is_in(T val, const unordered_set<T> &x){return x.count(val);}

    template<class T, class S> inline S& operator<<(S& os, const vector<T> &x){auto last=&x.back();os<<'[';for_in(y,x){os<<y; if(&y!=last)os<<" ";}os<<']'; return os;}
    template<class T, class S> inline S& operator<<(S& os, const deque<T> &x){auto last=&x.back();os<<'[';for_in(y,x){os<<y; if(&y!=last)os<<" ";}os<<']'; return os;}
    template<class T, size_t SIZE, class S> inline S& operator<<(S& os, const array<T,SIZE> &x){auto last=&x.back();os<<'[';for_in(y,x){os<<y; if(&y!=last)os<<" ";}os<<']'; return os;}
    template<class T, class S> S& operator<<(S& os, const set<T> &x){auto last=&x.back();os<<'{';for_in(y,x){os<<y; if(&y!=last)os<<" ";}os<<'}'; return os;}
    template<class T, class S> S& operator<<(S& os, const unordered_set<T> &x){auto last=&x.back();os<<'{';for_in(y,x){os<<y; if(&y!=last)os<<" ";}os<<'}'; return os;}
    template<class T, class U, class S> inline S& operator<<(S& os, const pair<T,U> &x){os<<x.first<<":"<<x.second; return os;}
    
    template<class T, class U> inline U max_value(const map<T,U> &x){U _max=(*x.begin()).second; for_in(p,x)_max=max(_max,p.second); return _max;}
    template<class T, class U> inline U min_value(const map<T,U> &x){U _min=(*x.begin()).second; for_in(p,x)_min=min(_min,p.second); return _min;}
    template<class T, class U> inline T max_key(const map<T,U> &x){return (*(--x.end())).first;}
    template<class T, class U> inline T min_key(const map<T,U> &x){return (*(x.begin())).first;}
    template<class T, class U> inline T argmax(const map<T,U> &x){T _argmax=(*x.begin()).first; U _max=(*x.begin()).second; for_in(p,x)if(_max<p.second){_argmax=p.first;_max=p.second;}return _argmax;}
    template<class T, class U> inline T argmin(const map<T,U> &x){T _argmin=(*x.begin()).first; U _min=(*x.begin()).second; for_in(p,x)if(_min>p.second){_argmin=p.first;_min=p.second;}return _argmin;}
    template<class T, class U> inline U sum_value(const map<T,U> &x){U _sum=(*x.begin()).second; for(auto it=++x.begin(); it!=x.end(); ++it) _sum+=(*it).second; return _sum;}
    template<class T, class U> inline T sum_key(const map<T,U> &x){T _sum=(*x.begin()).first; for(auto it=++x.begin(); it!=x.end(); ++it) _sum+=(*it).first; return _sum;}
    template<class T, class U> inline T get_key(const map<T,U> &x, U val){for_in(p,x)if(p.second==val)return p.first;}
    template<class T, class U> inline bool is_in_value(U val, const map<T,U> &x){for_in(p,x)if(p.second==val)return true; return false;}
    template<class T, class U> inline bool is_in_key(T key, const map<T,U> &x){try{x.at(key);}catch(out_of_range&){return false;} return true;}
    template<class T, class U, class S> inline S& operator<<(S& os, const map<T,U> &x){auto last=&x.back();os<<'{';for_in(y,x){os<<y; if(&y!=last)os<<" ";}os<<'}'; return os;}

    template<class T, class U> inline U max_value(const unordered_map<T,U> &x){U _max=(*x.begin()).second; for_in(p,x)_max=max(_max,p.second); return _max;}
    template<class T, class U> inline U min_value(const unordered_map<T,U> &x){U _min=(*x.begin()).second; for_in(p,x)_min=min(_min,p.second); return _min;}
    template<class T, class U> inline T max_key(const unordered_map<T,U> &x){T _max=(*x.begin()).first; for_in(p,x)_max=max(_max,p.first); return _max;}
    template<class T, class U> inline T min_key(const unordered_map<T,U> &x){T _min=(*x.begin()).first; for_in(p,x)_min=min(_min,p.first); return _min;}
    template<class T, class U> inline T argmax(const unordered_map<T,U> &x){T _argmax=(*x.begin()).first; U _max=(*x.begin()).second; for_in(p,x)if(_max<p.second){_argmax=p.first;_max=p.second;}return _argmax;}
    template<class T, class U> inline T argmin(const unordered_map<T,U> &x){T _argmin=(*x.begin()).first; U _min=(*x.begin()).second; for_in(p,x)if(_min>p.second){_argmin=p.first;_min=p.second;}return _argmin;}
    template<class T, class U> inline U sum_value(const unordered_map<T,U> &x){U _sum=(*x.begin()).second; for(auto it=++x.begin(); it!=x.end(); ++it) _sum+=(*it).second; return _sum;}
    template<class T, class U> inline T sum_key(const unordered_map<T,U> &x){T _sum=(*x.begin()).first; for(auto it=++x.begin(); it!=x.end(); ++it) _sum+=(*it).first; return _sum;}
    template<class T, class U> inline T get_key(const unordered_map<T,U> &x, U val){for_in(p,x)if(p.second==val)return p.first;}
    template<class T, class U> inline bool is_in_value(U val, const unordered_map<T,U> &x){for_in(p,x)if(p.second==val)return true; return false;}
    template<class T, class U> inline bool is_in_key(T key, const unordered_map<T,U> &x){try{x.at(key);}catch(out_of_range&){return false;} return true;}
    template<class T, class U, class S> inline S& operator<<(S& os, const unordered_map<T,U> &x){auto last=&x.back();os<<'{';for_in(y,x){os<<y; if(&y!=last)os<<" ";}os<<'}'; return os;}
#endif

int main(){
    init();

    uint N=input();
    v_u64 X(N);
    for_in(x,X)x=input();
    auto sum_org = sum(X);
    s64 min_sum = INT64_MAX;
    for_in(x,X)x =x*x;
    auto sum_sq = sum(X);
    for(s64 p=1; p<=100;p++){
        s64 local_sum = -2*p*sum_org + X.size()*p*p + sum_sq;
        if(local_sum<min_sum){
            min_sum = local_sum;
        }
    }
    print(min_sum);
}

Measured memory_bytes: 256