import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int res = Integer.MAX_VALUE;
        int[] X = new int[N];
        for(int i = 0; i < N; i++) X[i] = sc.nextInt();

        for(int i = 1; i <= 100; i++) {
            int tmp = 0;
            for(int j = 0; j < N; j++) {
                tmp += (int)Math.pow(Math.abs(X[j]-i), 2);
            }
            res = Math.min(res, tmp);
        }
        System.out.println(res);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int res = Integer.MAX_VALUE;
        int[] X = new int[N];
        for(int i = 0; i < N; i++) X[i] = sc.nextInt();

        for(int i = 1; i <= 100; i++) {
            int tmp = 0;
            for(int j = 0; j < N; j++) {
                tmp += (int)Math.pow(Math.abs(X[j]-i), 2);
            }
            res = Math.min(res, tmp);
        }
        System.out.println(res);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int res = Integer.MAX_VALUE;
        int[] X = new int[N];
        for(int i = 0; i < N; i++) X[i] = sc.nextInt();

        for(int i = 1; i <= 100; i++) {
            int tmp = 0;
            for(int j = 0; j < N; j++) {
                tmp += (int)Math.pow(Math.abs(X[j]-i), 2);
            }
            res = Math.min(res, tmp);
        }
        System.out.println(res);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int res = Integer.MAX_VALUE;
        int[] X = new int[N];
        for(int i = 0; i < N; i++) X[i] = sc.nextInt();

        for(int i = 1; i <= 100; i++) {
            int tmp = 0;
            for(int j = 0; j < N; j++) {
                tmp += (int)Math.pow(Math.abs(X[j]-i), 2);
            }
            res = Math.min(res, tmp);
        }
        System.out.println(res);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int res = Integer.MAX_VALUE; res Integer.MAX_VALUE Integer Integer.MAX_VALUE 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] X i sc.nextInt() sc.nextInt sc for(int i = 1; i <= 100; i++) {
            int tmp = 0;
            for(int j = 0; j < N; j++) {
                tmp += (int)Math.pow(Math.abs(X[j]-i), 2);
            }
            res = Math.min(res, tmp);
        } int i = 1; int i = 1; i 1 i <= 100 i 100 i++ i++ i {
            int tmp = 0;
            for(int j = 0; j < N; j++) {
                tmp += (int)Math.pow(Math.abs(X[j]-i), 2);
            }
            res = Math.min(res, tmp);
        } {
            int tmp = 0;
            for(int j = 0; j < N; j++) {
                tmp += (int)Math.pow(Math.abs(X[j]-i), 2);
            }
            res = Math.min(res, tmp);
        } int tmp = 0; tmp 0 for(int j = 0; j < N; j++) {
                tmp += (int)Math.pow(Math.abs(X[j]-i), 2);
            } int j = 0; int j = 0; j 0 j < N j N j++ j++ j {
                tmp += (int)Math.pow(Math.abs(X[j]-i), 2);
            } {
                tmp += (int)Math.pow(Math.abs(X[j]-i), 2);
            } tmp += (int)Math.pow(Math.abs(X[j]-i), 2) tmp (int)Math.pow(Math.abs(X[j]-i), 2) Math.pow Math Math.abs(X[j]-i) Math.abs Math X[j]-i X[j] X j i 2 res = Math.min(res, tmp) res Math.min(res, tmp) Math.min Math res tmp System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int res = Integer.MAX_VALUE;
        int[] X = new int[N];
        for(int i = 0; i < N; i++) X[i] = sc.nextInt();

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

        for(int i = 1; i <= 100; i++) {
            int tmp = 0;
            for(int j = 0; j < N; j++) {
                tmp += (int)Math.pow(Math.abs(X[j]-i), 2);
            }
            res = Math.min(res, tmp);
        }
        System.out.println(res);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int res = Integer.MAX_VALUE;
        int[] X = new int[N];
        for(int i = 0; i < N; i++) X[i] = sc.nextInt();

        for(int i = 1; i <= 100; i++) {
            int tmp = 0;
            for(int j = 0; j < N; j++) {
                tmp += (int)Math.pow(Math.abs(X[j]-i), 2);
            }
            res = Math.min(res, tmp);
        }
        System.out.println(res);
    }
}
