import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = Integer.parseInt(s.next());
        int[] arr = new int[N];
        for (int i = 0; i < N; i++) {
            int p = Integer.parseInt(s.next());
            arr[i] = p;
        }
        int ret = Integer.MAX_VALUE;
        for (int x = 1; x <= 100; x++) {
            int tmp = 0;
            for (int a : arr) {
                tmp += Math.pow(a - x, 2);
            }
            if (tmp < ret) {
                ret = tmp;
            }
        }
        System.out.println(ret);
    }
} import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = Integer.parseInt(s.next());
        int[] arr = new int[N];
        for (int i = 0; i < N; i++) {
            int p = Integer.parseInt(s.next());
            arr[i] = p;
        }
        int ret = Integer.MAX_VALUE;
        for (int x = 1; x <= 100; x++) {
            int tmp = 0;
            for (int a : arr) {
                tmp += Math.pow(a - x, 2);
            }
            if (tmp < ret) {
                ret = tmp;
            }
        }
        System.out.println(ret);
    }
} Main public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = Integer.parseInt(s.next());
        int[] arr = new int[N];
        for (int i = 0; i < N; i++) {
            int p = Integer.parseInt(s.next());
            arr[i] = p;
        }
        int ret = Integer.MAX_VALUE;
        for (int x = 1; x <= 100; x++) {
            int tmp = 0;
            for (int a : arr) {
                tmp += Math.pow(a - x, 2);
            }
            if (tmp < ret) {
                ret = tmp;
            }
        }
        System.out.println(ret);
    } main {
        Scanner s = new Scanner(System.in);
        int N = Integer.parseInt(s.next());
        int[] arr = new int[N];
        for (int i = 0; i < N; i++) {
            int p = Integer.parseInt(s.next());
            arr[i] = p;
        }
        int ret = Integer.MAX_VALUE;
        for (int x = 1; x <= 100; x++) {
            int tmp = 0;
            for (int a : arr) {
                tmp += Math.pow(a - x, 2);
            }
            if (tmp < ret) {
                ret = tmp;
            }
        }
        System.out.println(ret);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) int N = Integer.parseInt(s.next()); N Integer.parseInt(s.next()) Integer.parseInt Integer s.next() s.next s int[] arr = new int[N]; arr new int[N] N for (int i = 0; i < N; i++) {
            int p = Integer.parseInt(s.next());
            arr[i] = p;
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            int p = Integer.parseInt(s.next());
            arr[i] = p;
        } {
            int p = Integer.parseInt(s.next());
            arr[i] = p;
        } int p = Integer.parseInt(s.next()); p Integer.parseInt(s.next()) Integer.parseInt Integer s.next() s.next s arr[i] = p arr[i] arr i p int ret = Integer.MAX_VALUE; ret Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int x = 1; x <= 100; x++) {
            int tmp = 0;
            for (int a : arr) {
                tmp += Math.pow(a - x, 2);
            }
            if (tmp < ret) {
                ret = tmp;
            }
        } int x = 1; int x = 1; x 1 x <= 100 x 100 x++ x++ x {
            int tmp = 0;
            for (int a : arr) {
                tmp += Math.pow(a - x, 2);
            }
            if (tmp < ret) {
                ret = tmp;
            }
        } {
            int tmp = 0;
            for (int a : arr) {
                tmp += Math.pow(a - x, 2);
            }
            if (tmp < ret) {
                ret = tmp;
            }
        } int tmp = 0; tmp 0 for (int a : arr) {
                tmp += Math.pow(a - x, 2);
            } int a arr {
                tmp += Math.pow(a - x, 2);
            } {
                tmp += Math.pow(a - x, 2);
            } tmp += Math.pow(a - x, 2) tmp Math.pow(a - x, 2) Math.pow Math a - x a x 2 if (tmp < ret) {
                ret = tmp;
            } tmp < ret tmp ret {
                ret = tmp;
            } ret = tmp ret tmp System.out.println(ret) System.out.println System.out System System.out ret String[] args args public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = Integer.parseInt(s.next());
        int[] arr = new int[N];
        for (int i = 0; i < N; i++) {
            int p = Integer.parseInt(s.next());
            arr[i] = p;
        }
        int ret = Integer.MAX_VALUE;
        for (int x = 1; x <= 100; x++) {
            int tmp = 0;
            for (int a : arr) {
                tmp += Math.pow(a - x, 2);
            }
            if (tmp < ret) {
                ret = tmp;
            }
        }
        System.out.println(ret);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = Integer.parseInt(s.next());
        int[] arr = new int[N];
        for (int i = 0; i < N; i++) {
            int p = Integer.parseInt(s.next());
            arr[i] = p;
        }
        int ret = Integer.MAX_VALUE;
        for (int x = 1; x <= 100; x++) {
            int tmp = 0;
            for (int a : arr) {
                tmp += Math.pow(a - x, 2);
            }
            if (tmp < ret) {
                ret = tmp;
            }
        }
        System.out.println(ret);
    }
} Main
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = Integer.parseInt(s.next());
        int[] arr = new int[N];
        for (int i = 0; i < N; i++) {
            int p = Integer.parseInt(s.next());
            arr[i] = p;
        }
        int ret = Integer.MAX_VALUE;
        for (int x = 1; x <= 100; x++) {
            int tmp = 0;
            for (int a : arr) {
                tmp += Math.pow(a - x, 2);
            }
            if (tmp < ret) {
                ret = tmp;
            }
        }
        System.out.println(ret);
    }
}