import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];
        double sum = 0;
        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
        }
        int P = (int)Math.round(sum/N);
        
        int dis=0;

        for (int i = 0; i < N; i++) {
            dis+=Math.pow((X[i]-P), 2);
        }
        System.out.println(dis);
    }
} import java.util.Scanner; Scanner 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];
        double sum = 0;
        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
        }
        int P = (int)Math.round(sum/N);
        
        int dis=0;

        for (int i = 0; i < N; i++) {
            dis+=Math.pow((X[i]-P), 2);
        }
        System.out.println(dis);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];
        double sum = 0;
        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
        }
        int P = (int)Math.round(sum/N);
        
        int dis=0;

        for (int i = 0; i < N; i++) {
            dis+=Math.pow((X[i]-P), 2);
        }
        System.out.println(dis);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];
        double sum = 0;
        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
        }
        int P = (int)Math.round(sum/N);
        
        int dis=0;

        for (int i = 0; i < N; i++) {
            dis+=Math.pow((X[i]-P), 2);
        }
        System.out.println(dis);
    } 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 double sum = 0; sum 0 for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            X[i] = sc.nextInt();
            sum += X[i];
        } {
            X[i] = sc.nextInt();
            sum += X[i];
        } X[i] = sc.nextInt() X[i] X i sc.nextInt() sc.nextInt sc sum += X[i] sum X[i] X i int P = (int)Math.round(sum/N); P (int)Math.round(sum/N) Math.round Math sum/N sum N int dis=0; dis 0 for (int i = 0; i < N; i++) {
            dis+=Math.pow((X[i]-P), 2);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            dis+=Math.pow((X[i]-P), 2);
        } {
            dis+=Math.pow((X[i]-P), 2);
        } dis+=Math.pow((X[i]-P), 2) dis Math.pow((X[i]-P), 2) Math.pow Math (X[i]-P) X[i] X i P 2 System.out.println(dis) System.out.println System.out System System.out dis 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];
        double sum = 0;
        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
        }
        int P = (int)Math.round(sum/N);
        
        int dis=0;

        for (int i = 0; i < N; i++) {
            dis+=Math.pow((X[i]-P), 2);
        }
        System.out.println(dis);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];
        double sum = 0;
        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
        }
        int P = (int)Math.round(sum/N);
        
        int dis=0;

        for (int i = 0; i < N; i++) {
            dis+=Math.pow((X[i]-P), 2);
        }
        System.out.println(dis);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];
        double sum = 0;
        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
        }
        int P = (int)Math.round(sum/N);
        
        int dis=0;

        for (int i = 0; i < N; i++) {
            dis+=Math.pow((X[i]-P), 2);
        }
        System.out.println(dis);
    }
}