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];

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

		int min = Integer.MAX_VALUE;
		for (int p = 0; p < 101; p++) {
			int total = 0;
			for ( int i = 0; i < n; i++) {
				total += (x[i] - p) * (x[i] - p);
			}

			if (total < min) {
				min = total;
			}
		}

		System.out.println(min);

	}

} 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];

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

		int min = Integer.MAX_VALUE;
		for (int p = 0; p < 101; p++) {
			int total = 0;
			for ( int i = 0; i < n; i++) {
				total += (x[i] - p) * (x[i] - p);
			}

			if (total < min) {
				min = total;
			}
		}

		System.out.println(min);

	}

} 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 min = Integer.MAX_VALUE;
		for (int p = 0; p < 101; p++) {
			int total = 0;
			for ( int i = 0; i < n; i++) {
				total += (x[i] - p) * (x[i] - p);
			}

			if (total < min) {
				min = total;
			}
		}

		System.out.println(min);

	} 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 min = Integer.MAX_VALUE;
		for (int p = 0; p < 101; p++) {
			int total = 0;
			for ( int i = 0; i < n; i++) {
				total += (x[i] - p) * (x[i] - p);
			}

			if (total < min) {
				min = total;
			}
		}

		System.out.println(min);

	} 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 min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int p = 0; p < 101; p++) {
			int total = 0;
			for ( int i = 0; i < n; i++) {
				total += (x[i] - p) * (x[i] - p);
			}

			if (total < min) {
				min = total;
			}
		} int p = 0; int p = 0; p 0 p < 101 p 101 p++ p++ p {
			int total = 0;
			for ( int i = 0; i < n; i++) {
				total += (x[i] - p) * (x[i] - p);
			}

			if (total < min) {
				min = total;
			}
		} {
			int total = 0;
			for ( int i = 0; i < n; i++) {
				total += (x[i] - p) * (x[i] - p);
			}

			if (total < min) {
				min = total;
			}
		} int total = 0; total 0 for ( int i = 0; i < n; i++) {
				total += (x[i] - p) * (x[i] - p);
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				total += (x[i] - p) * (x[i] - p);
			} {
				total += (x[i] - p) * (x[i] - p);
			} total += (x[i] - p) * (x[i] - p) total (x[i] - p) * (x[i] - p) (x[i] - p) x[i] x i p (x[i] - p) x[i] x i p if (total < min) {
				min = total;
			} total < min total min {
				min = total;
			} min = total min total System.out.println(min) System.out.println System.out System System.out min 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 min = Integer.MAX_VALUE;
		for (int p = 0; p < 101; p++) {
			int total = 0;
			for ( int i = 0; i < n; i++) {
				total += (x[i] - p) * (x[i] - p);
			}

			if (total < min) {
				min = total;
			}
		}

		System.out.println(min);

	}

} 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 min = Integer.MAX_VALUE;
		for (int p = 0; p < 101; p++) {
			int total = 0;
			for ( int i = 0; i < n; i++) {
				total += (x[i] - p) * (x[i] - p);
			}

			if (total < min) {
				min = total;
			}
		}

		System.out.println(min);

	}

} 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];

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

		int min = Integer.MAX_VALUE;
		for (int p = 0; p < 101; p++) {
			int total = 0;
			for ( int i = 0; i < n; i++) {
				total += (x[i] - p) * (x[i] - p);
			}

			if (total < min) {
				min = total;
			}
		}

		System.out.println(min);

	}

}
