import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];

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

        int min = Integer.MAX_VALUE;
        for (int P = 1; P <= 100; P++) {
            int cnd = 0;
            for (int i = 0; i < N; i++) {
                cnd += (X[i] - P) * (X[i] - P);
            }
            min = Math.min(min, cnd);
        }

        System.out.println(min);
        return;
    }

} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
} Main public static void main(String[] args) {
        new Solver().run();
    } main {
        new Solver().run();
    } new Solver().run() new Solver().run new Solver() String[] args args class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];

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

        int min = Integer.MAX_VALUE;
        for (int P = 1; P <= 100; P++) {
            int cnd = 0;
            for (int i = 0; i < N; i++) {
                cnd += (X[i] - P) * (X[i] - P);
            }
            min = Math.min(min, cnd);
        }

        System.out.println(min);
        return;
    }

} Solver public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];

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

        int min = Integer.MAX_VALUE;
        for (int P = 1; P <= 100; P++) {
            int cnd = 0;
            for (int i = 0; i < N; i++) {
                cnd += (X[i] - P) * (X[i] - P);
            }
            min = Math.min(min, cnd);
        }

        System.out.println(min);
        return;
    } run {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];

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

        int min = Integer.MAX_VALUE;
        for (int P = 1; P <= 100; P++) {
            int cnd = 0;
            for (int i = 0; i < N; i++) {
                cnd += (X[i] - P) * (X[i] - P);
            }
            min = Math.min(min, cnd);
        }

        System.out.println(min);
        return;
    } 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 int sum = 0; sum 0 for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            X[i] = sc.nextInt();
            sum += X[i];
        } {
            X[i] = sc.nextInt();
            sum += X[i];
        } X[i] = sc.nextInt() X[i] X i sc.nextInt() sc.nextInt sc sum += X[i] sum X[i] X i int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int P = 1; P <= 100; P++) {
            int cnd = 0;
            for (int i = 0; i < N; i++) {
                cnd += (X[i] - P) * (X[i] - P);
            }
            min = Math.min(min, cnd);
        } int P = 1; int P = 1; P 1 P <= 100 P 100 P++ P++ P {
            int cnd = 0;
            for (int i = 0; i < N; i++) {
                cnd += (X[i] - P) * (X[i] - P);
            }
            min = Math.min(min, cnd);
        } {
            int cnd = 0;
            for (int i = 0; i < N; i++) {
                cnd += (X[i] - P) * (X[i] - P);
            }
            min = Math.min(min, cnd);
        } int cnd = 0; cnd 0 for (int i = 0; i < N; i++) {
                cnd += (X[i] - P) * (X[i] - P);
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
                cnd += (X[i] - P) * (X[i] - P);
            } {
                cnd += (X[i] - P) * (X[i] - P);
            } cnd += (X[i] - P) * (X[i] - P) cnd (X[i] - P) * (X[i] - P) (X[i] - P) X[i] X i P (X[i] - P) X[i] X i P min = Math.min(min, cnd) min Math.min(min, cnd) Math.min Math min cnd System.out.println(min) System.out.println System.out System System.out min return;
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];

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

        int min = Integer.MAX_VALUE;
        for (int P = 1; P <= 100; P++) {
            int cnd = 0;
            for (int i = 0; i < N; i++) {
                cnd += (X[i] - P) * (X[i] - P);
            }
            min = Math.min(min, cnd);
        }

        System.out.println(min);
        return;
    }

}