
import java.util.Scanner;

public class Main {

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

        int n = scan.nextInt();
        int max = 0, min = 100;
        int x[] = new int[n];
        for (int i=0; i < n;i ++) {
            x[i] = scan.nextInt();
            if (x[i] > max) {
                max = x[i];
            }

            if (x[i] < min) {
                min = x[i];
            }
        }

        int minTotal = 99999999;
        for (int i = min; i <= max; i++) {
            int total = 0;
            for (int k = 0; k < n; k++) {
                total += Math.pow((x[k] - i), 2);
            }

            if (total < minTotal) {
                minTotal = total;
            }
        }
        System.out.println(minTotal);
    }
} import java.util.Scanner; Scanner java.util public class Main {

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

        int n = scan.nextInt();
        int max = 0, min = 100;
        int x[] = new int[n];
        for (int i=0; i < n;i ++) {
            x[i] = scan.nextInt();
            if (x[i] > max) {
                max = x[i];
            }

            if (x[i] < min) {
                min = x[i];
            }
        }

        int minTotal = 99999999;
        for (int i = min; i <= max; i++) {
            int total = 0;
            for (int k = 0; k < n; k++) {
                total += Math.pow((x[k] - i), 2);
            }

            if (total < minTotal) {
                minTotal = total;
            }
        }
        System.out.println(minTotal);
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        int max = 0, min = 100;
        int x[] = new int[n];
        for (int i=0; i < n;i ++) {
            x[i] = scan.nextInt();
            if (x[i] > max) {
                max = x[i];
            }

            if (x[i] < min) {
                min = x[i];
            }
        }

        int minTotal = 99999999;
        for (int i = min; i <= max; i++) {
            int total = 0;
            for (int k = 0; k < n; k++) {
                total += Math.pow((x[k] - i), 2);
            }

            if (total < minTotal) {
                minTotal = total;
            }
        }
        System.out.println(minTotal);
    } main {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        int max = 0, min = 100;
        int x[] = new int[n];
        for (int i=0; i < n;i ++) {
            x[i] = scan.nextInt();
            if (x[i] > max) {
                max = x[i];
            }

            if (x[i] < min) {
                min = x[i];
            }
        }

        int minTotal = 99999999;
        for (int i = min; i <= max; i++) {
            int total = 0;
            for (int k = 0; k < n; k++) {
                total += Math.pow((x[k] - i), 2);
            }

            if (total < minTotal) {
                minTotal = total;
            }
        }
        System.out.println(minTotal);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int max = 0 max 0 min = 100; min 100 int x[] = new int[n]; x new int[n] n for (int i=0; i < n;i ++) {
            x[i] = scan.nextInt();
            if (x[i] > max) {
                max = x[i];
            }

            if (x[i] < min) {
                min = x[i];
            }
        } int i=0; int i=0; i 0 i < n i n i ++ i ++ i {
            x[i] = scan.nextInt();
            if (x[i] > max) {
                max = x[i];
            }

            if (x[i] < min) {
                min = x[i];
            }
        } {
            x[i] = scan.nextInt();
            if (x[i] > max) {
                max = x[i];
            }

            if (x[i] < min) {
                min = x[i];
            }
        } x[i] = scan.nextInt() x[i] x i scan.nextInt() scan.nextInt scan if (x[i] > max) {
                max = x[i];
            } x[i] > max x[i] x i max {
                max = x[i];
            } max = x[i] max x[i] x i if (x[i] < min) {
                min = x[i];
            } x[i] < min x[i] x i min {
                min = x[i];
            } min = x[i] min x[i] x i int minTotal = 99999999; minTotal 99999999 for (int i = min; i <= max; i++) {
            int total = 0;
            for (int k = 0; k < n; k++) {
                total += Math.pow((x[k] - i), 2);
            }

            if (total < minTotal) {
                minTotal = total;
            }
        } int i = min; int i = min; i min i <= max i max i++ i++ i {
            int total = 0;
            for (int k = 0; k < n; k++) {
                total += Math.pow((x[k] - i), 2);
            }

            if (total < minTotal) {
                minTotal = total;
            }
        } {
            int total = 0;
            for (int k = 0; k < n; k++) {
                total += Math.pow((x[k] - i), 2);
            }

            if (total < minTotal) {
                minTotal = total;
            }
        } int total = 0; total 0 for (int k = 0; k < n; k++) {
                total += Math.pow((x[k] - i), 2);
            } int k = 0; int k = 0; k 0 k < n k n k++ k++ k {
                total += Math.pow((x[k] - i), 2);
            } {
                total += Math.pow((x[k] - i), 2);
            } total += Math.pow((x[k] - i), 2) total Math.pow((x[k] - i), 2) Math.pow Math (x[k] - i) x[k] x k i 2 if (total < minTotal) {
                minTotal = total;
            } total < minTotal total minTotal {
                minTotal = total;
            } minTotal = total minTotal total System.out.println(minTotal) System.out.println System.out System System.out minTotal String[] args args public class Main {

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

        int n = scan.nextInt();
        int max = 0, min = 100;
        int x[] = new int[n];
        for (int i=0; i < n;i ++) {
            x[i] = scan.nextInt();
            if (x[i] > max) {
                max = x[i];
            }

            if (x[i] < min) {
                min = x[i];
            }
        }

        int minTotal = 99999999;
        for (int i = min; i <= max; i++) {
            int total = 0;
            for (int k = 0; k < n; k++) {
                total += Math.pow((x[k] - i), 2);
            }

            if (total < minTotal) {
                minTotal = total;
            }
        }
        System.out.println(minTotal);
    }
} public class Main {

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

        int n = scan.nextInt();
        int max = 0, min = 100;
        int x[] = new int[n];
        for (int i=0; i < n;i ++) {
            x[i] = scan.nextInt();
            if (x[i] > max) {
                max = x[i];
            }

            if (x[i] < min) {
                min = x[i];
            }
        }

        int minTotal = 99999999;
        for (int i = min; i <= max; i++) {
            int total = 0;
            for (int k = 0; k < n; k++) {
                total += Math.pow((x[k] - i), 2);
            }

            if (total < minTotal) {
                minTotal = total;
            }
        }
        System.out.println(minTotal);
    }
} Main

import java.util.Scanner;

public class Main {

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

        int n = scan.nextInt();
        int max = 0, min = 100;
        int x[] = new int[n];
        for (int i=0; i < n;i ++) {
            x[i] = scan.nextInt();
            if (x[i] > max) {
                max = x[i];
            }

            if (x[i] < min) {
                min = x[i];
            }
        }

        int minTotal = 99999999;
        for (int i = min; i <= max; i++) {
            int total = 0;
            for (int k = 0; k < n; k++) {
                total += Math.pow((x[k] - i), 2);
            }

            if (total < minTotal) {
                minTotal = total;
            }
        }
        System.out.println(minTotal);
    }
}