import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);

        int n = stdIn.nextInt();
        int[] x = new int[n];
        for(int i=0; i<n; i++){
            x[i] = stdIn.nextInt();
        }

        long minEnergy = Long.MAX_VALUE;
        for(int pos=1; pos<=100; pos++){
            long energy = 0;
            for(int i=0; i<n; i++){
                energy += Math.pow((x[i] - pos), 2);
            }
            if(energy < minEnergy){
                minEnergy = energy;
            }
        }

        System.out.println(minEnergy);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);

        int n = stdIn.nextInt();
        int[] x = new int[n];
        for(int i=0; i<n; i++){
            x[i] = stdIn.nextInt();
        }

        long minEnergy = Long.MAX_VALUE;
        for(int pos=1; pos<=100; pos++){
            long energy = 0;
            for(int i=0; i<n; i++){
                energy += Math.pow((x[i] - pos), 2);
            }
            if(energy < minEnergy){
                minEnergy = energy;
            }
        }

        System.out.println(minEnergy);
    }
} Main public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);

        int n = stdIn.nextInt();
        int[] x = new int[n];
        for(int i=0; i<n; i++){
            x[i] = stdIn.nextInt();
        }

        long minEnergy = Long.MAX_VALUE;
        for(int pos=1; pos<=100; pos++){
            long energy = 0;
            for(int i=0; i<n; i++){
                energy += Math.pow((x[i] - pos), 2);
            }
            if(energy < minEnergy){
                minEnergy = energy;
            }
        }

        System.out.println(minEnergy);
    } main {
        Scanner stdIn = new Scanner(System.in);

        int n = stdIn.nextInt();
        int[] x = new int[n];
        for(int i=0; i<n; i++){
            x[i] = stdIn.nextInt();
        }

        long minEnergy = Long.MAX_VALUE;
        for(int pos=1; pos<=100; pos++){
            long energy = 0;
            for(int i=0; i<n; i++){
                energy += Math.pow((x[i] - pos), 2);
            }
            if(energy < minEnergy){
                minEnergy = energy;
            }
        }

        System.out.println(minEnergy);
    } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int[] x = new int[n]; x new int[n] n for(int i=0; i<n; i++){
            x[i] = stdIn.nextInt();
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            x[i] = stdIn.nextInt();
        } {
            x[i] = stdIn.nextInt();
        } x[i] = stdIn.nextInt() x[i] x i stdIn.nextInt() stdIn.nextInt stdIn long minEnergy = Long.MAX_VALUE; minEnergy Long.MAX_VALUE Long Long.MAX_VALUE for(int pos=1; pos<=100; pos++){
            long energy = 0;
            for(int i=0; i<n; i++){
                energy += Math.pow((x[i] - pos), 2);
            }
            if(energy < minEnergy){
                minEnergy = energy;
            }
        } int pos=1; int pos=1; pos 1 pos<=100 pos 100 pos++ pos++ pos {
            long energy = 0;
            for(int i=0; i<n; i++){
                energy += Math.pow((x[i] - pos), 2);
            }
            if(energy < minEnergy){
                minEnergy = energy;
            }
        } {
            long energy = 0;
            for(int i=0; i<n; i++){
                energy += Math.pow((x[i] - pos), 2);
            }
            if(energy < minEnergy){
                minEnergy = energy;
            }
        } long energy = 0; energy 0 for(int i=0; i<n; i++){
                energy += Math.pow((x[i] - pos), 2);
            } int i=0; int i=0; i 0 i<n i n i++ i++ i {
                energy += Math.pow((x[i] - pos), 2);
            } {
                energy += Math.pow((x[i] - pos), 2);
            } energy += Math.pow((x[i] - pos), 2) energy Math.pow((x[i] - pos), 2) Math.pow Math (x[i] - pos) x[i] x i pos 2 if(energy < minEnergy){
                minEnergy = energy;
            } energy < minEnergy energy minEnergy {
                minEnergy = energy;
            } minEnergy = energy minEnergy energy System.out.println(minEnergy) System.out.println System.out System System.out minEnergy String[] args args public class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);

        int n = stdIn.nextInt();
        int[] x = new int[n];
        for(int i=0; i<n; i++){
            x[i] = stdIn.nextInt();
        }

        long minEnergy = Long.MAX_VALUE;
        for(int pos=1; pos<=100; pos++){
            long energy = 0;
            for(int i=0; i<n; i++){
                energy += Math.pow((x[i] - pos), 2);
            }
            if(energy < minEnergy){
                minEnergy = energy;
            }
        }

        System.out.println(minEnergy);
    }
} public class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);

        int n = stdIn.nextInt();
        int[] x = new int[n];
        for(int i=0; i<n; i++){
            x[i] = stdIn.nextInt();
        }

        long minEnergy = Long.MAX_VALUE;
        for(int pos=1; pos<=100; pos++){
            long energy = 0;
            for(int i=0; i<n; i++){
                energy += Math.pow((x[i] - pos), 2);
            }
            if(energy < minEnergy){
                minEnergy = energy;
            }
        }

        System.out.println(minEnergy);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);

        int n = stdIn.nextInt();
        int[] x = new int[n];
        for(int i=0; i<n; i++){
            x[i] = stdIn.nextInt();
        }

        long minEnergy = Long.MAX_VALUE;
        for(int pos=1; pos<=100; pos++){
            long energy = 0;
            for(int i=0; i<n; i++){
                energy += Math.pow((x[i] - pos), 2);
            }
            if(energy < minEnergy){
                minEnergy = energy;
            }
        }

        System.out.println(minEnergy);
    }
}