import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] x = new int[n];
        int maxx = 0;
        int minx = 101;
        for(int i = 0; i < n; i++){
            x[i] = scan.nextInt();
            if(x[i] > maxx){
                maxx = x[i];
            }
            if(x[i] < minx){
                minx = x[i];
            }
        }
        int min = 0;
        int out = Integer.MAX_VALUE;
        for(int i = minx; i <= maxx; i++){
            for(int j = 0; j < n; j++){
                min += Math.pow(x[j] - i, 2);
            }
            if(out > min){
                out = min;
            }
            min = 0;
        }
        System.out.println(out);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] x = new int[n];
        int maxx = 0;
        int minx = 101;
        for(int i = 0; i < n; i++){
            x[i] = scan.nextInt();
            if(x[i] > maxx){
                maxx = x[i];
            }
            if(x[i] < minx){
                minx = x[i];
            }
        }
        int min = 0;
        int out = Integer.MAX_VALUE;
        for(int i = minx; i <= maxx; i++){
            for(int j = 0; j < n; j++){
                min += Math.pow(x[j] - i, 2);
            }
            if(out > min){
                out = min;
            }
            min = 0;
        }
        System.out.println(out);
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] x = new int[n];
        int maxx = 0;
        int minx = 101;
        for(int i = 0; i < n; i++){
            x[i] = scan.nextInt();
            if(x[i] > maxx){
                maxx = x[i];
            }
            if(x[i] < minx){
                minx = x[i];
            }
        }
        int min = 0;
        int out = Integer.MAX_VALUE;
        for(int i = minx; i <= maxx; i++){
            for(int j = 0; j < n; j++){
                min += Math.pow(x[j] - i, 2);
            }
            if(out > min){
                out = min;
            }
            min = 0;
        }
        System.out.println(out);
    } main {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] x = new int[n];
        int maxx = 0;
        int minx = 101;
        for(int i = 0; i < n; i++){
            x[i] = scan.nextInt();
            if(x[i] > maxx){
                maxx = x[i];
            }
            if(x[i] < minx){
                minx = x[i];
            }
        }
        int min = 0;
        int out = Integer.MAX_VALUE;
        for(int i = minx; i <= maxx; i++){
            for(int j = 0; j < n; j++){
                min += Math.pow(x[j] - i, 2);
            }
            if(out > min){
                out = min;
            }
            min = 0;
        }
        System.out.println(out);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] x = new int[n]; x new int[n] n int maxx = 0; maxx 0 int minx = 101; minx 101 for(int i = 0; i < n; i++){
            x[i] = scan.nextInt();
            if(x[i] > maxx){
                maxx = x[i];
            }
            if(x[i] < minx){
                minx = x[i];
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            x[i] = scan.nextInt();
            if(x[i] > maxx){
                maxx = x[i];
            }
            if(x[i] < minx){
                minx = x[i];
            }
        } {
            x[i] = scan.nextInt();
            if(x[i] > maxx){
                maxx = x[i];
            }
            if(x[i] < minx){
                minx = x[i];
            }
        } x[i] = scan.nextInt() x[i] x i scan.nextInt() scan.nextInt scan if(x[i] > maxx){
                maxx = x[i];
            } x[i] > maxx x[i] x i maxx {
                maxx = x[i];
            } maxx = x[i] maxx x[i] x i if(x[i] < minx){
                minx = x[i];
            } x[i] < minx x[i] x i minx {
                minx = x[i];
            } minx = x[i] minx x[i] x i int min = 0; min 0 int out = Integer.MAX_VALUE; out Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = minx; i <= maxx; i++){
            for(int j = 0; j < n; j++){
                min += Math.pow(x[j] - i, 2);
            }
            if(out > min){
                out = min;
            }
            min = 0;
        } int i = minx; int i = minx; i minx i <= maxx i maxx i++ i++ i {
            for(int j = 0; j < n; j++){
                min += Math.pow(x[j] - i, 2);
            }
            if(out > min){
                out = min;
            }
            min = 0;
        } {
            for(int j = 0; j < n; j++){
                min += Math.pow(x[j] - i, 2);
            }
            if(out > min){
                out = min;
            }
            min = 0;
        } for(int j = 0; j < n; j++){
                min += Math.pow(x[j] - i, 2);
            } int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
                min += Math.pow(x[j] - i, 2);
            } {
                min += Math.pow(x[j] - i, 2);
            } min += Math.pow(x[j] - i, 2) min Math.pow(x[j] - i, 2) Math.pow Math x[j] - i x[j] x j i 2 if(out > min){
                out = min;
            } out > min out min {
                out = min;
            } out = min out min min = 0 min 0 System.out.println(out) System.out.println System.out System System.out out String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] x = new int[n];
        int maxx = 0;
        int minx = 101;
        for(int i = 0; i < n; i++){
            x[i] = scan.nextInt();
            if(x[i] > maxx){
                maxx = x[i];
            }
            if(x[i] < minx){
                minx = x[i];
            }
        }
        int min = 0;
        int out = Integer.MAX_VALUE;
        for(int i = minx; i <= maxx; i++){
            for(int j = 0; j < n; j++){
                min += Math.pow(x[j] - i, 2);
            }
            if(out > min){
                out = min;
            }
            min = 0;
        }
        System.out.println(out);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] x = new int[n];
        int maxx = 0;
        int minx = 101;
        for(int i = 0; i < n; i++){
            x[i] = scan.nextInt();
            if(x[i] > maxx){
                maxx = x[i];
            }
            if(x[i] < minx){
                minx = x[i];
            }
        }
        int min = 0;
        int out = Integer.MAX_VALUE;
        for(int i = minx; i <= maxx; i++){
            for(int j = 0; j < n; j++){
                min += Math.pow(x[j] - i, 2);
            }
            if(out > min){
                out = min;
            }
            min = 0;
        }
        System.out.println(out);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] x = new int[n];
        int maxx = 0;
        int minx = 101;
        for(int i = 0; i < n; i++){
            x[i] = scan.nextInt();
            if(x[i] > maxx){
                maxx = x[i];
            }
            if(x[i] < minx){
                minx = x[i];
            }
        }
        int min = 0;
        int out = Integer.MAX_VALUE;
        for(int i = minx; i <= maxx; i++){
            for(int j = 0; j < n; j++){
                min += Math.pow(x[j] - i, 2);
            }
            if(out > min){
                out = min;
            }
            min = 0;
        }
        System.out.println(out);
    }
}