import java.util.*;

class Main {
	Scanner sc;
	int N;
	int[] X;
	
	private void calc() {
		sc = new Scanner(System.in);
		N = sc.nextInt();
		X = new int[N];
		for (int i = 0; i < N; i++) X[i] = sc.nextInt();
		
		int m = Integer.MAX_VALUE;
		for (int p = 1; p < 101; p++) {
			int s = 0;
			for (int i = 0; i < N; i++)
				s += (X[i]-p)*(X[i]-p);
			m = Math.min(m, s);
		}
		System.out.println(m);
	}

	public static void main(String[] args) {
		new Main().calc();
	}
} import java.util.*; util.* java class Main {
	Scanner sc;
	int N;
	int[] X;
	
	private void calc() {
		sc = new Scanner(System.in);
		N = sc.nextInt();
		X = new int[N];
		for (int i = 0; i < N; i++) X[i] = sc.nextInt();
		
		int m = Integer.MAX_VALUE;
		for (int p = 1; p < 101; p++) {
			int s = 0;
			for (int i = 0; i < N; i++)
				s += (X[i]-p)*(X[i]-p);
			m = Math.min(m, s);
		}
		System.out.println(m);
	}

	public static void main(String[] args) {
		new Main().calc();
	}
} Main Scanner sc; sc int N; N int[] X; X private void calc() {
		sc = new Scanner(System.in);
		N = sc.nextInt();
		X = new int[N];
		for (int i = 0; i < N; i++) X[i] = sc.nextInt();
		
		int m = Integer.MAX_VALUE;
		for (int p = 1; p < 101; p++) {
			int s = 0;
			for (int i = 0; i < N; i++)
				s += (X[i]-p)*(X[i]-p);
			m = Math.min(m, s);
		}
		System.out.println(m);
	} calc {
		sc = new Scanner(System.in);
		N = sc.nextInt();
		X = new int[N];
		for (int i = 0; i < N; i++) X[i] = sc.nextInt();
		
		int m = Integer.MAX_VALUE;
		for (int p = 1; p < 101; p++) {
			int s = 0;
			for (int i = 0; i < N; i++)
				s += (X[i]-p)*(X[i]-p);
			m = Math.min(m, s);
		}
		System.out.println(m);
	} sc = new Scanner(System.in) sc new Scanner(System.in) N = sc.nextInt() N sc.nextInt() sc.nextInt sc 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] X i sc.nextInt() sc.nextInt sc int m = Integer.MAX_VALUE; m Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int p = 1; p < 101; p++) {
			int s = 0;
			for (int i = 0; i < N; i++)
				s += (X[i]-p)*(X[i]-p);
			m = Math.min(m, s);
		} int p = 1; int p = 1; p 1 p < 101 p 101 p++ p++ p {
			int s = 0;
			for (int i = 0; i < N; i++)
				s += (X[i]-p)*(X[i]-p);
			m = Math.min(m, s);
		} {
			int s = 0;
			for (int i = 0; i < N; i++)
				s += (X[i]-p)*(X[i]-p);
			m = Math.min(m, s);
		} int s = 0; s 0 for (int i = 0; i < N; i++)
				s += (X[i]-p)*(X[i]-p); int i = 0; int i = 0; i 0 i < N i N i++ i++ i s += (X[i]-p)*(X[i]-p); s += (X[i]-p)*(X[i]-p) s (X[i]-p)*(X[i]-p) (X[i]-p) X[i] X i p (X[i]-p) X[i] X i p m = Math.min(m, s) m Math.min(m, s) Math.min Math m s System.out.println(m) System.out.println System.out System System.out m public static void main(String[] args) {
		new Main().calc();
	} main {
		new Main().calc();
	} new Main().calc() new Main().calc new Main() String[] args args
import java.util.*;

class Main {
	Scanner sc;
	int N;
	int[] X;
	
	private void calc() {
		sc = new Scanner(System.in);
		N = sc.nextInt();
		X = new int[N];
		for (int i = 0; i < N; i++) X[i] = sc.nextInt();
		
		int m = Integer.MAX_VALUE;
		for (int p = 1; p < 101; p++) {
			int s = 0;
			for (int i = 0; i < N; i++)
				s += (X[i]-p)*(X[i]-p);
			m = Math.min(m, s);
		}
		System.out.println(m);
	}

	public static void main(String[] args) {
		new Main().calc();
	}
}
