import java.util.*;

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

        int N = sc.nextInt();
        int[] X = new int[N];

        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
        }

        int minSum = 1000000000;
        int sum = 0;

        for (int P = 0; P <= 100; P++) {
            for (int i = 0; i < N; i++) {
                sum += Math.pow(X[i] - (P + 1), 2);
            }
            minSum = Math.min(minSum, sum);
            sum = 0;
        }

        System.out.println(minSum);

    }
} 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[] X = new int[N];

        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
        }

        int minSum = 1000000000;
        int sum = 0;

        for (int P = 0; P <= 100; P++) {
            for (int i = 0; i < N; i++) {
                sum += Math.pow(X[i] - (P + 1), 2);
            }
            minSum = Math.min(minSum, sum);
            sum = 0;
        }

        System.out.println(minSum);

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

        int N = sc.nextInt();
        int[] X = new int[N];

        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
        }

        int minSum = 1000000000;
        int sum = 0;

        for (int P = 0; P <= 100; P++) {
            for (int i = 0; i < N; i++) {
                sum += Math.pow(X[i] - (P + 1), 2);
            }
            minSum = Math.min(minSum, sum);
            sum = 0;
        }

        System.out.println(minSum);

    } main {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] X = new int[N];

        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
        }

        int minSum = 1000000000;
        int sum = 0;

        for (int P = 0; P <= 100; P++) {
            for (int i = 0; i < N; i++) {
                sum += Math.pow(X[i] - (P + 1), 2);
            }
            minSum = Math.min(minSum, sum);
            sum = 0;
        }

        System.out.println(minSum);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] X = new int[N]; X new int[N] N for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            X[i] = sc.nextInt();
        } {
            X[i] = sc.nextInt();
        } X[i] = sc.nextInt() X[i] X i sc.nextInt() sc.nextInt sc int minSum = 1000000000; minSum 1000000000 int sum = 0; sum 0 for (int P = 0; P <= 100; P++) {
            for (int i = 0; i < N; i++) {
                sum += Math.pow(X[i] - (P + 1), 2);
            }
            minSum = Math.min(minSum, sum);
            sum = 0;
        } int P = 0; int P = 0; P 0 P <= 100 P 100 P++ P++ P {
            for (int i = 0; i < N; i++) {
                sum += Math.pow(X[i] - (P + 1), 2);
            }
            minSum = Math.min(minSum, sum);
            sum = 0;
        } {
            for (int i = 0; i < N; i++) {
                sum += Math.pow(X[i] - (P + 1), 2);
            }
            minSum = Math.min(minSum, sum);
            sum = 0;
        } for (int i = 0; i < N; i++) {
                sum += Math.pow(X[i] - (P + 1), 2);
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
                sum += Math.pow(X[i] - (P + 1), 2);
            } {
                sum += Math.pow(X[i] - (P + 1), 2);
            } sum += Math.pow(X[i] - (P + 1), 2) sum Math.pow(X[i] - (P + 1), 2) Math.pow Math X[i] - (P + 1) X[i] X i (P + 1) P 1 2 minSum = Math.min(minSum, sum) minSum Math.min(minSum, sum) Math.min Math minSum sum sum = 0 sum 0 System.out.println(minSum) System.out.println System.out System System.out minSum String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] X = new int[N];

        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
        }

        int minSum = 1000000000;
        int sum = 0;

        for (int P = 0; P <= 100; P++) {
            for (int i = 0; i < N; i++) {
                sum += Math.pow(X[i] - (P + 1), 2);
            }
            minSum = Math.min(minSum, sum);
            sum = 0;
        }

        System.out.println(minSum);

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

        int N = sc.nextInt();
        int[] X = new int[N];

        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
        }

        int minSum = 1000000000;
        int sum = 0;

        for (int P = 0; P <= 100; P++) {
            for (int i = 0; i < N; i++) {
                sum += Math.pow(X[i] - (P + 1), 2);
            }
            minSum = Math.min(minSum, sum);
            sum = 0;
        }

        System.out.println(minSum);

    }
} Main
import java.util.*;

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

        int N = sc.nextInt();
        int[] X = new int[N];

        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
        }

        int minSum = 1000000000;
        int sum = 0;

        for (int P = 0; P <= 100; P++) {
            for (int i = 0; i < N; i++) {
                sum += Math.pow(X[i] - (P + 1), 2);
            }
            minSum = Math.min(minSum, sum);
            sum = 0;
        }

        System.out.println(minSum);

    }
}
