import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        for(int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        int sum = 0;
        int point = 0;
        for(int j = 0; j < n; j++) {
            sum += x[j];
        }
        double ave = (double)sum / n;
        if(ave % 1 >= 0.5){
        point = (int)ave + 1;
        }else{
            point = (int)ave;
        }
        long ans = 0;
        for(int i = 0; i < n; i++) {
            ans += ((point - x[i]) * (point - x[i])); 
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        for(int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        int sum = 0;
        int point = 0;
        for(int j = 0; j < n; j++) {
            sum += x[j];
        }
        double ave = (double)sum / n;
        if(ave % 1 >= 0.5){
        point = (int)ave + 1;
        }else{
            point = (int)ave;
        }
        long ans = 0;
        for(int i = 0; i < n; i++) {
            ans += ((point - x[i]) * (point - x[i])); 
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        for(int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        int sum = 0;
        int point = 0;
        for(int j = 0; j < n; j++) {
            sum += x[j];
        }
        double ave = (double)sum / n;
        if(ave % 1 >= 0.5){
        point = (int)ave + 1;
        }else{
            point = (int)ave;
        }
        long ans = 0;
        for(int i = 0; i < n; i++) {
            ans += ((point - x[i]) * (point - x[i])); 
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        for(int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        int sum = 0;
        int point = 0;
        for(int j = 0; j < n; j++) {
            sum += x[j];
        }
        double ave = (double)sum / n;
        if(ave % 1 >= 0.5){
        point = (int)ave + 1;
        }else{
            point = (int)ave;
        }
        long ans = 0;
        for(int i = 0; i < n; i++) {
            ans += ((point - x[i]) * (point - x[i])); 
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc 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] = sc.nextInt() x[i] x i sc.nextInt() sc.nextInt sc int sum = 0; sum 0 int point = 0; point 0 for(int j = 0; j < n; j++) {
            sum += x[j];
        } int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
            sum += x[j];
        } {
            sum += x[j];
        } sum += x[j] sum x[j] x j double ave = (double)sum / n; ave (double)sum / n (double)sum n if(ave % 1 >= 0.5){
        point = (int)ave + 1;
        }else{
            point = (int)ave;
        } ave % 1 >= 0.5 ave % 1 ave 1 0.5 {
        point = (int)ave + 1;
        } point = (int)ave + 1 point (int)ave + 1 (int)ave 1 {
            point = (int)ave;
        } point = (int)ave point (int)ave long ans = 0; ans 0 for(int i = 0; i < n; i++) {
            ans += ((point - x[i]) * (point - x[i])); 
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            ans += ((point - x[i]) * (point - x[i])); 
        } {
            ans += ((point - x[i]) * (point - x[i])); 
        } ans += ((point - x[i]) * (point - x[i])) ans ((point - x[i]) * (point - x[i])) (point - x[i]) point x[i] x i (point - x[i]) point x[i] x i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        for(int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        int sum = 0;
        int point = 0;
        for(int j = 0; j < n; j++) {
            sum += x[j];
        }
        double ave = (double)sum / n;
        if(ave % 1 >= 0.5){
        point = (int)ave + 1;
        }else{
            point = (int)ave;
        }
        long ans = 0;
        for(int i = 0; i < n; i++) {
            ans += ((point - x[i]) * (point - x[i])); 
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        for(int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        int sum = 0;
        int point = 0;
        for(int j = 0; j < n; j++) {
            sum += x[j];
        }
        double ave = (double)sum / n;
        if(ave % 1 >= 0.5){
        point = (int)ave + 1;
        }else{
            point = (int)ave;
        }
        long ans = 0;
        for(int i = 0; i < n; i++) {
            ans += ((point - x[i]) * (point - x[i])); 
        }
        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        for(int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        int sum = 0;
        int point = 0;
        for(int j = 0; j < n; j++) {
            sum += x[j];
        }
        double ave = (double)sum / n;
        if(ave % 1 >= 0.5){
        point = (int)ave + 1;
        }else{
            point = (int)ave;
        }
        long ans = 0;
        for(int i = 0; i < n; i++) {
            ans += ((point - x[i]) * (point - x[i])); 
        }
        System.out.println(ans);
    }
}