import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        sc.useDelimiter(",");
//        DecimalFormat df = new DecimalFormat("0.00000000");
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = Integer.parseInt(sc.next());
        long sum = 0;
        long ans = 1000000000;
        for (int j = 0; j <= 100; j++) {
            for (int i = 0; i < n; i++) {
                sum += (a[i] - j) * (a[i] - j);
            }
            ans = Math.min(sum, ans);
            sum = 0;
        }
        out.println(ans);
        out.flush();
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        sc.useDelimiter(",");
//        DecimalFormat df = new DecimalFormat("0.00000000");
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = Integer.parseInt(sc.next());
        long sum = 0;
        long ans = 1000000000;
        for (int j = 0; j <= 100; j++) {
            for (int i = 0; i < n; i++) {
                sum += (a[i] - j) * (a[i] - j);
            }
            ans = Math.min(sum, ans);
            sum = 0;
        }
        out.println(ans);
        out.flush();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        sc.useDelimiter(",");
//        DecimalFormat df = new DecimalFormat("0.00000000");
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = Integer.parseInt(sc.next());
        long sum = 0;
        long ans = 1000000000;
        for (int j = 0; j <= 100; j++) {
            for (int i = 0; i < n; i++) {
                sum += (a[i] - j) * (a[i] - j);
            }
            ans = Math.min(sum, ans);
            sum = 0;
        }
        out.println(ans);
        out.flush();
    } main {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        sc.useDelimiter(",");
//        DecimalFormat df = new DecimalFormat("0.00000000");
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = Integer.parseInt(sc.next());
        long sum = 0;
        long ans = 1000000000;
        for (int j = 0; j <= 100; j++) {
            for (int i = 0; i < n; i++) {
                sum += (a[i] - j) * (a[i] - j);
            }
            ans = Math.min(sum, ans);
            sum = 0;
        }
        out.println(ans);
        out.flush();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++)
            a[i] = Integer.parseInt(sc.next()); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = Integer.parseInt(sc.next()); a[i] = Integer.parseInt(sc.next()) a[i] a i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long sum = 0; sum 0 long ans = 1000000000; ans 1000000000 for (int j = 0; j <= 100; j++) {
            for (int i = 0; i < n; i++) {
                sum += (a[i] - j) * (a[i] - j);
            }
            ans = Math.min(sum, ans);
            sum = 0;
        } int j = 0; int j = 0; j 0 j <= 100 j 100 j++ j++ j {
            for (int i = 0; i < n; i++) {
                sum += (a[i] - j) * (a[i] - j);
            }
            ans = Math.min(sum, ans);
            sum = 0;
        } {
            for (int i = 0; i < n; i++) {
                sum += (a[i] - j) * (a[i] - j);
            }
            ans = Math.min(sum, ans);
            sum = 0;
        } for (int i = 0; i < n; i++) {
                sum += (a[i] - j) * (a[i] - j);
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                sum += (a[i] - j) * (a[i] - j);
            } {
                sum += (a[i] - j) * (a[i] - j);
            } sum += (a[i] - j) * (a[i] - j) sum (a[i] - j) * (a[i] - j) (a[i] - j) a[i] a i j (a[i] - j) a[i] a i j ans = Math.min(sum, ans) ans Math.min(sum, ans) Math.min Math sum ans sum = 0 sum 0 out.println(ans) out.println out ans out.flush() out.flush out String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        sc.useDelimiter(",");
//        DecimalFormat df = new DecimalFormat("0.00000000");
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = Integer.parseInt(sc.next());
        long sum = 0;
        long ans = 1000000000;
        for (int j = 0; j <= 100; j++) {
            for (int i = 0; i < n; i++) {
                sum += (a[i] - j) * (a[i] - j);
            }
            ans = Math.min(sum, ans);
            sum = 0;
        }
        out.println(ans);
        out.flush();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        sc.useDelimiter(",");
//        DecimalFormat df = new DecimalFormat("0.00000000");
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = Integer.parseInt(sc.next());
        long sum = 0;
        long ans = 1000000000;
        for (int j = 0; j <= 100; j++) {
            for (int i = 0; i < n; i++) {
                sum += (a[i] - j) * (a[i] - j);
            }
            ans = Math.min(sum, ans);
            sum = 0;
        }
        out.println(ans);
        out.flush();
    }
} Main
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        sc.useDelimiter(",");
//        DecimalFormat df = new DecimalFormat("0.00000000");
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = Integer.parseInt(sc.next());
        long sum = 0;
        long ans = 1000000000;
        for (int j = 0; j <= 100; j++) {
            for (int i = 0; i < n; i++) {
                sum += (a[i] - j) * (a[i] - j);
            }
            ans = Math.min(sum, ans);
            sum = 0;
        }
        out.println(ans);
        out.flush();
    }
}