import java.util.Arrays;
import java.util.Scanner;

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

        int[] coordinatesLine = new int[n];
        for (int i = 0; i < n; i++) {
            coordinatesLine[i] = scanner.nextInt();
        }
        Arrays.sort(coordinatesLine);
        int answer = Integer.MAX_VALUE;
        for (int i = 1; i < 100; i++) {
            int temp = 0;
            for (int k = 0; k < n; k++) {
                int square = coordinatesLine[k] - i;
                temp += square * square;
            }
            if (temp < answer) {
                answer = temp;
            }
        }
        System.out.println(answer);
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        int[] coordinatesLine = new int[n];
        for (int i = 0; i < n; i++) {
            coordinatesLine[i] = scanner.nextInt();
        }
        Arrays.sort(coordinatesLine);
        int answer = Integer.MAX_VALUE;
        for (int i = 1; i < 100; i++) {
            int temp = 0;
            for (int k = 0; k < n; k++) {
                int square = coordinatesLine[k] - i;
                temp += square * square;
            }
            if (temp < answer) {
                answer = temp;
            }
        }
        System.out.println(answer);
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        int[] coordinatesLine = new int[n];
        for (int i = 0; i < n; i++) {
            coordinatesLine[i] = scanner.nextInt();
        }
        Arrays.sort(coordinatesLine);
        int answer = Integer.MAX_VALUE;
        for (int i = 1; i < 100; i++) {
            int temp = 0;
            for (int k = 0; k < n; k++) {
                int square = coordinatesLine[k] - i;
                temp += square * square;
            }
            if (temp < answer) {
                answer = temp;
            }
        }
        System.out.println(answer);
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        int[] coordinatesLine = new int[n];
        for (int i = 0; i < n; i++) {
            coordinatesLine[i] = scanner.nextInt();
        }
        Arrays.sort(coordinatesLine);
        int answer = Integer.MAX_VALUE;
        for (int i = 1; i < 100; i++) {
            int temp = 0;
            for (int k = 0; k < n; k++) {
                int square = coordinatesLine[k] - i;
                temp += square * square;
            }
            if (temp < answer) {
                answer = temp;
            }
        }
        System.out.println(answer);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] coordinatesLine = new int[n]; coordinatesLine new int[n] n for (int i = 0; i < n; i++) {
            coordinatesLine[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            coordinatesLine[i] = scanner.nextInt();
        } {
            coordinatesLine[i] = scanner.nextInt();
        } coordinatesLine[i] = scanner.nextInt() coordinatesLine[i] coordinatesLine i scanner.nextInt() scanner.nextInt scanner Arrays.sort(coordinatesLine) Arrays.sort Arrays coordinatesLine int answer = Integer.MAX_VALUE; answer Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 1; i < 100; i++) {
            int temp = 0;
            for (int k = 0; k < n; k++) {
                int square = coordinatesLine[k] - i;
                temp += square * square;
            }
            if (temp < answer) {
                answer = temp;
            }
        } int i = 1; int i = 1; i 1 i < 100 i 100 i++ i++ i {
            int temp = 0;
            for (int k = 0; k < n; k++) {
                int square = coordinatesLine[k] - i;
                temp += square * square;
            }
            if (temp < answer) {
                answer = temp;
            }
        } {
            int temp = 0;
            for (int k = 0; k < n; k++) {
                int square = coordinatesLine[k] - i;
                temp += square * square;
            }
            if (temp < answer) {
                answer = temp;
            }
        } int temp = 0; temp 0 for (int k = 0; k < n; k++) {
                int square = coordinatesLine[k] - i;
                temp += square * square;
            } int k = 0; int k = 0; k 0 k < n k n k++ k++ k {
                int square = coordinatesLine[k] - i;
                temp += square * square;
            } {
                int square = coordinatesLine[k] - i;
                temp += square * square;
            } int square = coordinatesLine[k] - i; square coordinatesLine[k] - i coordinatesLine[k] coordinatesLine k i temp += square * square temp square * square square square if (temp < answer) {
                answer = temp;
            } temp < answer temp answer {
                answer = temp;
            } answer = temp answer temp System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        int[] coordinatesLine = new int[n];
        for (int i = 0; i < n; i++) {
            coordinatesLine[i] = scanner.nextInt();
        }
        Arrays.sort(coordinatesLine);
        int answer = Integer.MAX_VALUE;
        for (int i = 1; i < 100; i++) {
            int temp = 0;
            for (int k = 0; k < n; k++) {
                int square = coordinatesLine[k] - i;
                temp += square * square;
            }
            if (temp < answer) {
                answer = temp;
            }
        }
        System.out.println(answer);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        int[] coordinatesLine = new int[n];
        for (int i = 0; i < n; i++) {
            coordinatesLine[i] = scanner.nextInt();
        }
        Arrays.sort(coordinatesLine);
        int answer = Integer.MAX_VALUE;
        for (int i = 1; i < 100; i++) {
            int temp = 0;
            for (int k = 0; k < n; k++) {
                int square = coordinatesLine[k] - i;
                temp += square * square;
            }
            if (temp < answer) {
                answer = temp;
            }
        }
        System.out.println(answer);
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

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

        int[] coordinatesLine = new int[n];
        for (int i = 0; i < n; i++) {
            coordinatesLine[i] = scanner.nextInt();
        }
        Arrays.sort(coordinatesLine);
        int answer = Integer.MAX_VALUE;
        for (int i = 1; i < 100; i++) {
            int temp = 0;
            for (int k = 0; k < n; k++) {
                int square = coordinatesLine[k] - i;
                temp += square * square;
            }
            if (temp < answer) {
                answer = temp;
            }
        }
        System.out.println(answer);
    }
}
