

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double best = 999999999;
        ArrayList<Integer> locations = new ArrayList<>();
        int people = sc.nextInt();
        for (int i=0;i<people;i++){
            locations.add(sc.nextInt());
        }
        int locationlength = locations.size();
        for (int i=0;i<101;i++) {
            double thisres = 0;
            for (int j=0;j<locationlength;j++) {
                thisres += Math.pow(Math.abs(i-locations.get(j)), 2);
            }
            if (thisres < best) {
                best = thisres;
            }
        }
        System.out.println((int) best);

    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double best = 999999999;
        ArrayList<Integer> locations = new ArrayList<>();
        int people = sc.nextInt();
        for (int i=0;i<people;i++){
            locations.add(sc.nextInt());
        }
        int locationlength = locations.size();
        for (int i=0;i<101;i++) {
            double thisres = 0;
            for (int j=0;j<locationlength;j++) {
                thisres += Math.pow(Math.abs(i-locations.get(j)), 2);
            }
            if (thisres < best) {
                best = thisres;
            }
        }
        System.out.println((int) best);

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double best = 999999999;
        ArrayList<Integer> locations = new ArrayList<>();
        int people = sc.nextInt();
        for (int i=0;i<people;i++){
            locations.add(sc.nextInt());
        }
        int locationlength = locations.size();
        for (int i=0;i<101;i++) {
            double thisres = 0;
            for (int j=0;j<locationlength;j++) {
                thisres += Math.pow(Math.abs(i-locations.get(j)), 2);
            }
            if (thisres < best) {
                best = thisres;
            }
        }
        System.out.println((int) best);

    } main {
        Scanner sc = new Scanner(System.in);
        double best = 999999999;
        ArrayList<Integer> locations = new ArrayList<>();
        int people = sc.nextInt();
        for (int i=0;i<people;i++){
            locations.add(sc.nextInt());
        }
        int locationlength = locations.size();
        for (int i=0;i<101;i++) {
            double thisres = 0;
            for (int j=0;j<locationlength;j++) {
                thisres += Math.pow(Math.abs(i-locations.get(j)), 2);
            }
            if (thisres < best) {
                best = thisres;
            }
        }
        System.out.println((int) best);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double best = 999999999; best 999999999 ArrayList<Integer> locations = new ArrayList<>(); locations new ArrayList<>() int people = sc.nextInt(); people sc.nextInt() sc.nextInt sc for (int i=0;i<people;i++){
            locations.add(sc.nextInt());
        } int i=0; int i=0; i 0 i<people i people i++ i++ i {
            locations.add(sc.nextInt());
        } {
            locations.add(sc.nextInt());
        } locations.add(sc.nextInt()) locations.add locations sc.nextInt() sc.nextInt sc int locationlength = locations.size(); locationlength locations.size() locations.size locations for (int i=0;i<101;i++) {
            double thisres = 0;
            for (int j=0;j<locationlength;j++) {
                thisres += Math.pow(Math.abs(i-locations.get(j)), 2);
            }
            if (thisres < best) {
                best = thisres;
            }
        } int i=0; int i=0; i 0 i<101 i 101 i++ i++ i {
            double thisres = 0;
            for (int j=0;j<locationlength;j++) {
                thisres += Math.pow(Math.abs(i-locations.get(j)), 2);
            }
            if (thisres < best) {
                best = thisres;
            }
        } {
            double thisres = 0;
            for (int j=0;j<locationlength;j++) {
                thisres += Math.pow(Math.abs(i-locations.get(j)), 2);
            }
            if (thisres < best) {
                best = thisres;
            }
        } double thisres = 0; thisres 0 for (int j=0;j<locationlength;j++) {
                thisres += Math.pow(Math.abs(i-locations.get(j)), 2);
            } int j=0; int j=0; j 0 j<locationlength j locationlength j++ j++ j {
                thisres += Math.pow(Math.abs(i-locations.get(j)), 2);
            } {
                thisres += Math.pow(Math.abs(i-locations.get(j)), 2);
            } thisres += Math.pow(Math.abs(i-locations.get(j)), 2) thisres Math.pow(Math.abs(i-locations.get(j)), 2) Math.pow Math Math.abs(i-locations.get(j)) Math.abs Math i-locations.get(j) i locations.get(j) locations.get locations j 2 if (thisres < best) {
                best = thisres;
            } thisres < best thisres best {
                best = thisres;
            } best = thisres best thisres System.out.println((int) best) System.out.println System.out System System.out (int) best String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double best = 999999999;
        ArrayList<Integer> locations = new ArrayList<>();
        int people = sc.nextInt();
        for (int i=0;i<people;i++){
            locations.add(sc.nextInt());
        }
        int locationlength = locations.size();
        for (int i=0;i<101;i++) {
            double thisres = 0;
            for (int j=0;j<locationlength;j++) {
                thisres += Math.pow(Math.abs(i-locations.get(j)), 2);
            }
            if (thisres < best) {
                best = thisres;
            }
        }
        System.out.println((int) best);

    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double best = 999999999;
        ArrayList<Integer> locations = new ArrayList<>();
        int people = sc.nextInt();
        for (int i=0;i<people;i++){
            locations.add(sc.nextInt());
        }
        int locationlength = locations.size();
        for (int i=0;i<101;i++) {
            double thisres = 0;
            for (int j=0;j<locationlength;j++) {
                thisres += Math.pow(Math.abs(i-locations.get(j)), 2);
            }
            if (thisres < best) {
                best = thisres;
            }
        }
        System.out.println((int) best);

    }
} Main


import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double best = 999999999;
        ArrayList<Integer> locations = new ArrayList<>();
        int people = sc.nextInt();
        for (int i=0;i<people;i++){
            locations.add(sc.nextInt());
        }
        int locationlength = locations.size();
        for (int i=0;i<101;i++) {
            double thisres = 0;
            for (int j=0;j<locationlength;j++) {
                thisres += Math.pow(Math.abs(i-locations.get(j)), 2);
            }
            if (thisres < best) {
                best = thisres;
            }
        }
        System.out.println((int) best);

    }
}
