import java.math.*;
import java.util.*;
import java.lang.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        int ans = 1001001001;
        for(int i = 0 ; i<x.length;i++){
            x[i] = sc.nextInt();
        }
        for(int i = 0; i<=100 ;i++){
            int tmp = 0;
            for(int j = 0;j<n;j++){
                tmp += (x[j]-i)*(x[j]-i);
            }
            ans = Math.min(tmp,ans);
        }
        System.out.println(ans);
    }
} import java.math.*; math.* java import java.util.*; util.* java import java.lang.*; lang.* java class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        int ans = 1001001001;
        for(int i = 0 ; i<x.length;i++){
            x[i] = sc.nextInt();
        }
        for(int i = 0; i<=100 ;i++){
            int tmp = 0;
            for(int j = 0;j<n;j++){
                tmp += (x[j]-i)*(x[j]-i);
            }
            ans = Math.min(tmp,ans);
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        int ans = 1001001001;
        for(int i = 0 ; i<x.length;i++){
            x[i] = sc.nextInt();
        }
        for(int i = 0; i<=100 ;i++){
            int tmp = 0;
            for(int j = 0;j<n;j++){
                tmp += (x[j]-i)*(x[j]-i);
            }
            ans = Math.min(tmp,ans);
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        int ans = 1001001001;
        for(int i = 0 ; i<x.length;i++){
            x[i] = sc.nextInt();
        }
        for(int i = 0; i<=100 ;i++){
            int tmp = 0;
            for(int j = 0;j<n;j++){
                tmp += (x[j]-i)*(x[j]-i);
            }
            ans = Math.min(tmp,ans);
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] x = new int[n]; x new int[n] n int ans = 1001001001; ans 1001001001 for(int i = 0 ; i<x.length;i++){
            x[i] = sc.nextInt();
        } int i = 0 ; int i = 0 ; i 0 i<x.length i x.length x x.length i++ i++ i {
            x[i] = sc.nextInt();
        } {
            x[i] = sc.nextInt();
        } x[i] = sc.nextInt() x[i] x i sc.nextInt() sc.nextInt sc for(int i = 0; i<=100 ;i++){
            int tmp = 0;
            for(int j = 0;j<n;j++){
                tmp += (x[j]-i)*(x[j]-i);
            }
            ans = Math.min(tmp,ans);
        } int i = 0; int i = 0; i 0 i<=100 i 100 i++ i++ i {
            int tmp = 0;
            for(int j = 0;j<n;j++){
                tmp += (x[j]-i)*(x[j]-i);
            }
            ans = Math.min(tmp,ans);
        } {
            int tmp = 0;
            for(int j = 0;j<n;j++){
                tmp += (x[j]-i)*(x[j]-i);
            }
            ans = Math.min(tmp,ans);
        } int tmp = 0; tmp 0 for(int j = 0;j<n;j++){
                tmp += (x[j]-i)*(x[j]-i);
            } int j = 0; int j = 0; j 0 j<n j n j++ j++ j {
                tmp += (x[j]-i)*(x[j]-i);
            } {
                tmp += (x[j]-i)*(x[j]-i);
            } tmp += (x[j]-i)*(x[j]-i) tmp (x[j]-i)*(x[j]-i) (x[j]-i) x[j] x j i (x[j]-i) x[j] x j i ans = Math.min(tmp,ans) ans Math.min(tmp,ans) Math.min Math tmp ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.math.*;
import java.util.*;
import java.lang.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        int ans = 1001001001;
        for(int i = 0 ; i<x.length;i++){
            x[i] = sc.nextInt();
        }
        for(int i = 0; i<=100 ;i++){
            int tmp = 0;
            for(int j = 0;j<n;j++){
                tmp += (x[j]-i)*(x[j]-i);
            }
            ans = Math.min(tmp,ans);
        }
        System.out.println(ans);
    }
}
