import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double N = Double.parseDouble(sc.next());

        int[] X = new int[(int)N];

        for (int i = 0 ; i < N; i++) {
            X[i] = sc.nextInt();
        }

        double average = 0;

        for (int i = 0 ; i < N; i++) {
            average += X[i];
        }

        average = average / N;


        int sum = 0;

        for (int i = 0 ; i < N; i++) {
            sum += Math.pow((X[i] - Math.round(average)),2);
        }
        System.out.println(sum);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double N = Double.parseDouble(sc.next());

        int[] X = new int[(int)N];

        for (int i = 0 ; i < N; i++) {
            X[i] = sc.nextInt();
        }

        double average = 0;

        for (int i = 0 ; i < N; i++) {
            average += X[i];
        }

        average = average / N;


        int sum = 0;

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

        int[] X = new int[(int)N];

        for (int i = 0 ; i < N; i++) {
            X[i] = sc.nextInt();
        }

        double average = 0;

        for (int i = 0 ; i < N; i++) {
            average += X[i];
        }

        average = average / N;


        int sum = 0;

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

        int[] X = new int[(int)N];

        for (int i = 0 ; i < N; i++) {
            X[i] = sc.nextInt();
        }

        double average = 0;

        for (int i = 0 ; i < N; i++) {
            average += X[i];
        }

        average = average / N;


        int sum = 0;

        for (int i = 0 ; i < N; i++) {
            sum += Math.pow((X[i] - Math.round(average)),2);
        }
        System.out.println(sum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double N = Double.parseDouble(sc.next()); N Double.parseDouble(sc.next()) Double.parseDouble Double sc.next() sc.next sc int[] X = new int[(int)N]; X new int[(int)N] (int)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 double average = 0; average 0 for (int i = 0 ; i < N; i++) {
            average += X[i];
        } int i = 0 ; int i = 0 ; i 0 i < N i N i++ i++ i {
            average += X[i];
        } {
            average += X[i];
        } average += X[i] average X[i] X i average = average / N average average / N average N int sum = 0; sum 0 for (int i = 0 ; i < N; i++) {
            sum += Math.pow((X[i] - Math.round(average)),2);
        } int i = 0 ; int i = 0 ; i 0 i < N i N i++ i++ i {
            sum += Math.pow((X[i] - Math.round(average)),2);
        } {
            sum += Math.pow((X[i] - Math.round(average)),2);
        } sum += Math.pow((X[i] - Math.round(average)),2) sum Math.pow((X[i] - Math.round(average)),2) Math.pow Math (X[i] - Math.round(average)) X[i] X i Math.round(average) Math.round Math average 2 System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double N = Double.parseDouble(sc.next());

        int[] X = new int[(int)N];

        for (int i = 0 ; i < N; i++) {
            X[i] = sc.nextInt();
        }

        double average = 0;

        for (int i = 0 ; i < N; i++) {
            average += X[i];
        }

        average = average / N;


        int sum = 0;

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

        int[] X = new int[(int)N];

        for (int i = 0 ; i < N; i++) {
            X[i] = sc.nextInt();
        }

        double average = 0;

        for (int i = 0 ; i < N; i++) {
            average += X[i];
        }

        average = average / N;


        int sum = 0;

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double N = Double.parseDouble(sc.next());

        int[] X = new int[(int)N];

        for (int i = 0 ; i < N; i++) {
            X[i] = sc.nextInt();
        }

        double average = 0;

        for (int i = 0 ; i < N; i++) {
            average += X[i];
        }

        average = average / N;


        int sum = 0;

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