import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int x[] = new int[n];

        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            if (max < x[i]) {
                max = x[i];
            }
        }

        int min = 0;
        int pow = 0;
        int sum = 0;

        for (int i = 0; i <= max; i++) {
            sum = 0;
            for(int j = 0; j <n; j++){
                pow = (x[j] - i)*(x[j] - i);
                sum = sum + pow;
            }
            if(i==0 || min > sum){
                min = sum;
            }
        }

        System.out.println(min);
        sc.close();
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int x[] = new int[n];

        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            if (max < x[i]) {
                max = x[i];
            }
        }

        int min = 0;
        int pow = 0;
        int sum = 0;

        for (int i = 0; i <= max; i++) {
            sum = 0;
            for(int j = 0; j <n; j++){
                pow = (x[j] - i)*(x[j] - i);
                sum = sum + pow;
            }
            if(i==0 || min > sum){
                min = sum;
            }
        }

        System.out.println(min);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int x[] = new int[n];

        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            if (max < x[i]) {
                max = x[i];
            }
        }

        int min = 0;
        int pow = 0;
        int sum = 0;

        for (int i = 0; i <= max; i++) {
            sum = 0;
            for(int j = 0; j <n; j++){
                pow = (x[j] - i)*(x[j] - i);
                sum = sum + pow;
            }
            if(i==0 || min > sum){
                min = sum;
            }
        }

        System.out.println(min);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int x[] = new int[n];

        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            if (max < x[i]) {
                max = x[i];
            }
        }

        int min = 0;
        int pow = 0;
        int sum = 0;

        for (int i = 0; i <= max; i++) {
            sum = 0;
            for(int j = 0; j <n; j++){
                pow = (x[j] - i)*(x[j] - i);
                sum = sum + pow;
            }
            if(i==0 || min > sum){
                min = sum;
            }
        }

        System.out.println(min);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int max = 0; max 0 int x[] = new int[n]; x new int[n] n for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            if (max < x[i]) {
                max = x[i];
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            x[i] = sc.nextInt();
            if (max < x[i]) {
                max = x[i];
            }
        } {
            x[i] = sc.nextInt();
            if (max < x[i]) {
                max = x[i];
            }
        } x[i] = sc.nextInt() x[i] x i sc.nextInt() sc.nextInt sc if (max < x[i]) {
                max = x[i];
            } max < x[i] max x[i] x i {
                max = x[i];
            } max = x[i] max x[i] x i int min = 0; min 0 int pow = 0; pow 0 int sum = 0; sum 0 for (int i = 0; i <= max; i++) {
            sum = 0;
            for(int j = 0; j <n; j++){
                pow = (x[j] - i)*(x[j] - i);
                sum = sum + pow;
            }
            if(i==0 || min > sum){
                min = sum;
            }
        } int i = 0; int i = 0; i 0 i <= max i max i++ i++ i {
            sum = 0;
            for(int j = 0; j <n; j++){
                pow = (x[j] - i)*(x[j] - i);
                sum = sum + pow;
            }
            if(i==0 || min > sum){
                min = sum;
            }
        } {
            sum = 0;
            for(int j = 0; j <n; j++){
                pow = (x[j] - i)*(x[j] - i);
                sum = sum + pow;
            }
            if(i==0 || min > sum){
                min = sum;
            }
        } sum = 0 sum 0 for(int j = 0; j <n; j++){
                pow = (x[j] - i)*(x[j] - i);
                sum = sum + pow;
            } int j = 0; int j = 0; j 0 j <n j n j++ j++ j {
                pow = (x[j] - i)*(x[j] - i);
                sum = sum + pow;
            } {
                pow = (x[j] - i)*(x[j] - i);
                sum = sum + pow;
            } pow = (x[j] - i)*(x[j] - i) pow (x[j] - i)*(x[j] - i) (x[j] - i) x[j] x j i (x[j] - i) x[j] x j i sum = sum + pow sum sum + pow sum pow if(i==0 || min > sum){
                min = sum;
            } i==0 || min > sum i==0 i 0 min > sum min sum {
                min = sum;
            } min = sum min sum System.out.println(min) System.out.println System.out System System.out min sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int x[] = new int[n];

        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            if (max < x[i]) {
                max = x[i];
            }
        }

        int min = 0;
        int pow = 0;
        int sum = 0;

        for (int i = 0; i <= max; i++) {
            sum = 0;
            for(int j = 0; j <n; j++){
                pow = (x[j] - i)*(x[j] - i);
                sum = sum + pow;
            }
            if(i==0 || min > sum){
                min = sum;
            }
        }

        System.out.println(min);
        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int x[] = new int[n];

        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            if (max < x[i]) {
                max = x[i];
            }
        }

        int min = 0;
        int pow = 0;
        int sum = 0;

        for (int i = 0; i <= max; i++) {
            sum = 0;
            for(int j = 0; j <n; j++){
                pow = (x[j] - i)*(x[j] - i);
                sum = sum + pow;
            }
            if(i==0 || min > sum){
                min = sum;
            }
        }

        System.out.println(min);
        sc.close();
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int x[] = new int[n];

        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            if (max < x[i]) {
                max = x[i];
            }
        }

        int min = 0;
        int pow = 0;
        int sum = 0;

        for (int i = 0; i <= max; i++) {
            sum = 0;
            for(int j = 0; j <n; j++){
                pow = (x[j] - i)*(x[j] - i);
                sum = sum + pow;
            }
            if(i==0 || min > sum){
                min = sum;
            }
        }

        System.out.println(min);
        sc.close();
    }
}