import java.util.Scanner;

/**
 * TITLE : Rally URL
 * https://atcoder.jp/contests/abc156/tasks/abc156_c
 */
public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];
        int min = 100;
        int max = 0;
        int sum = 0;
        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
            min = min > X[i] ? X[i] : min;
            max = max < X[i] ? X[i] : max;
        }

        long P = Math.round((double) sum / X.length);
        int answer = 0;
        for (int i = 0; i < X.length; i++) {
            answer += (X[i] - P) * (X[i] - P);
        }
        System.out.println(answer);
        sc.close();
    }
} 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];
        int min = 100;
        int max = 0;
        int sum = 0;
        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
            min = min > X[i] ? X[i] : min;
            max = max < X[i] ? X[i] : max;
        }

        long P = Math.round((double) sum / X.length);
        int answer = 0;
        for (int i = 0; i < X.length; i++) {
            answer += (X[i] - P) * (X[i] - P);
        }
        System.out.println(answer);
        sc.close();
    }
} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];
        int min = 100;
        int max = 0;
        int sum = 0;
        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
            min = min > X[i] ? X[i] : min;
            max = max < X[i] ? X[i] : max;
        }

        long P = Math.round((double) sum / X.length);
        int answer = 0;
        for (int i = 0; i < X.length; i++) {
            answer += (X[i] - P) * (X[i] - P);
        }
        System.out.println(answer);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];
        int min = 100;
        int max = 0;
        int sum = 0;
        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
            min = min > X[i] ? X[i] : min;
            max = max < X[i] ? X[i] : max;
        }

        long P = Math.round((double) sum / X.length);
        int answer = 0;
        for (int i = 0; i < X.length; i++) {
            answer += (X[i] - P) * (X[i] - P);
        }
        System.out.println(answer);
        sc.close();
    } 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 int min = 100; min 100 int max = 0; max 0 int sum = 0; sum 0 for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
            min = min > X[i] ? X[i] : min;
            max = max < X[i] ? X[i] : max;
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            X[i] = sc.nextInt();
            sum += X[i];
            min = min > X[i] ? X[i] : min;
            max = max < X[i] ? X[i] : max;
        } {
            X[i] = sc.nextInt();
            sum += X[i];
            min = min > X[i] ? X[i] : min;
            max = max < X[i] ? X[i] : max;
        } X[i] = sc.nextInt() X[i] X i sc.nextInt() sc.nextInt sc sum += X[i] sum X[i] X i min = min > X[i] ? X[i] : min min min > X[i] ? X[i] : min min > X[i] min X[i] X i X[i] X i min max = max < X[i] ? X[i] : max max max < X[i] ? X[i] : max max < X[i] max X[i] X i X[i] X i max long P = Math.round((double) sum / X.length); P Math.round((double) sum / X.length) Math.round Math (double) sum / X.length (double) sum X.length X X.length int answer = 0; answer 0 for (int i = 0; i < X.length; i++) {
            answer += (X[i] - P) * (X[i] - P);
        } int i = 0; int i = 0; i 0 i < X.length i X.length X X.length i++ i++ i {
            answer += (X[i] - P) * (X[i] - P);
        } {
            answer += (X[i] - P) * (X[i] - P);
        } answer += (X[i] - P) * (X[i] - P) answer (X[i] - P) * (X[i] - P) (X[i] - P) X[i] X i P (X[i] - P) X[i] X i P System.out.println(answer) System.out.println System.out System System.out answer sc.close() sc.close sc 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];
        int min = 100;
        int max = 0;
        int sum = 0;
        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
            min = min > X[i] ? X[i] : min;
            max = max < X[i] ? X[i] : max;
        }

        long P = Math.round((double) sum / X.length);
        int answer = 0;
        for (int i = 0; i < X.length; i++) {
            answer += (X[i] - P) * (X[i] - P);
        }
        System.out.println(answer);
        sc.close();
    }
} public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];
        int min = 100;
        int max = 0;
        int sum = 0;
        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
            min = min > X[i] ? X[i] : min;
            max = max < X[i] ? X[i] : max;
        }

        long P = Math.round((double) sum / X.length);
        int answer = 0;
        for (int i = 0; i < X.length; i++) {
            answer += (X[i] - P) * (X[i] - P);
        }
        System.out.println(answer);
        sc.close();
    }
} Main
import java.util.Scanner;

/**
 * TITLE : Rally URL
 * https://atcoder.jp/contests/abc156/tasks/abc156_c
 */
public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] X = new int[N];
        int min = 100;
        int max = 0;
        int sum = 0;
        for (int i = 0; i < N; i++) {
            X[i] = sc.nextInt();
            sum += X[i];
            min = min > X[i] ? X[i] : min;
            max = max < X[i] ? X[i] : max;
        }

        long P = Math.round((double) sum / X.length);
        int answer = 0;
        for (int i = 0; i < X.length; i++) {
            answer += (X[i] - P) * (X[i] - P);
        }
        System.out.println(answer);
        sc.close();
    }
}