

import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < 100; i++) {
            int p = i + 1;
            int count = 0;
            for (int j = 0; j < n; j++) {
                count += (a[j] - p) * (a[j] - p);
            }

            ans = Math.min(ans, count);
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < 100; i++) {
            int p = i + 1;
            int count = 0;
            for (int j = 0; j < n; j++) {
                count += (a[j] - p) * (a[j] - p);
            }

            ans = Math.min(ans, count);
        }
        System.out.println(ans);
    }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < 100; i++) {
            int p = i + 1;
            int count = 0;
            for (int j = 0; j < n; j++) {
                count += (a[j] - p) * (a[j] - p);
            }

            ans = Math.min(ans, count);
        }
        System.out.println(ans);
    } main {
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < 100; i++) {
            int p = i + 1;
            int count = 0;
            for (int j = 0; j < n; j++) {
                count += (a[j] - p) * (a[j] - p);
            }

            ans = Math.min(ans, count);
        }
        System.out.println(ans);
    } int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a[i] = sc.nextInt();
        } {
            a[i] = sc.nextInt();
        } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i < 100; i++) {
            int p = i + 1;
            int count = 0;
            for (int j = 0; j < n; j++) {
                count += (a[j] - p) * (a[j] - p);
            }

            ans = Math.min(ans, count);
        } int i = 0; int i = 0; i 0 i < 100 i 100 i++ i++ i {
            int p = i + 1;
            int count = 0;
            for (int j = 0; j < n; j++) {
                count += (a[j] - p) * (a[j] - p);
            }

            ans = Math.min(ans, count);
        } {
            int p = i + 1;
            int count = 0;
            for (int j = 0; j < n; j++) {
                count += (a[j] - p) * (a[j] - p);
            }

            ans = Math.min(ans, count);
        } int p = i + 1; p i + 1 i 1 int count = 0; count 0 for (int j = 0; j < n; j++) {
                count += (a[j] - p) * (a[j] - p);
            } int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
                count += (a[j] - p) * (a[j] - p);
            } {
                count += (a[j] - p) * (a[j] - p);
            } count += (a[j] - p) * (a[j] - p) count (a[j] - p) * (a[j] - p) (a[j] - p) a[j] a j p (a[j] - p) a[j] a j p ans = Math.min(ans, count) ans Math.min(ans, count) Math.min Math ans count System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < 100; i++) {
            int p = i + 1;
            int count = 0;
            for (int j = 0; j < n; j++) {
                count += (a[j] - p) * (a[j] - p);
            }

            ans = Math.min(ans, count);
        }
        System.out.println(ans);
    }
} public class Main {
    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < 100; i++) {
            int p = i + 1;
            int count = 0;
            for (int j = 0; j < n; j++) {
                count += (a[j] - p) * (a[j] - p);
            }

            ans = Math.min(ans, count);
        }
        System.out.println(ans);
    }
} Main


import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < 100; i++) {
            int p = i + 1;
            int count = 0;
            for (int j = 0; j < n; j++) {
                count += (a[j] - p) * (a[j] - p);
            }

            ans = Math.min(ans, count);
        }
        System.out.println(ans);
    }
}
