import java.util.Scanner;

class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N=Integer.parseInt(sc.next());
		int[] x = new int[N];
		for(int i=0; i<N; i++) {
			x[i]=Integer.parseInt(sc.next());
		}
		int minimum =Integer.MAX_VALUE;
		for(int i=1; i<=100; i++) {
			int total = 0;
			for(int aa:x) {
				total +=(aa-i) * (aa-i);
			}
			minimum = Math.min(total, minimum);
		}
		System.out.println(minimum);
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N=Integer.parseInt(sc.next());
		int[] x = new int[N];
		for(int i=0; i<N; i++) {
			x[i]=Integer.parseInt(sc.next());
		}
		int minimum =Integer.MAX_VALUE;
		for(int i=1; i<=100; i++) {
			int total = 0;
			for(int aa:x) {
				total +=(aa-i) * (aa-i);
			}
			minimum = Math.min(total, minimum);
		}
		System.out.println(minimum);
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N=Integer.parseInt(sc.next());
		int[] x = new int[N];
		for(int i=0; i<N; i++) {
			x[i]=Integer.parseInt(sc.next());
		}
		int minimum =Integer.MAX_VALUE;
		for(int i=1; i<=100; i++) {
			int total = 0;
			for(int aa:x) {
				total +=(aa-i) * (aa-i);
			}
			minimum = Math.min(total, minimum);
		}
		System.out.println(minimum);
	} main {

		Scanner sc = new Scanner(System.in);
		int N=Integer.parseInt(sc.next());
		int[] x = new int[N];
		for(int i=0; i<N; i++) {
			x[i]=Integer.parseInt(sc.next());
		}
		int minimum =Integer.MAX_VALUE;
		for(int i=1; i<=100; i++) {
			int total = 0;
			for(int aa:x) {
				total +=(aa-i) * (aa-i);
			}
			minimum = Math.min(total, minimum);
		}
		System.out.println(minimum);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N=Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] x = new int[N]; x new int[N] N for(int i=0; i<N; i++) {
			x[i]=Integer.parseInt(sc.next());
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			x[i]=Integer.parseInt(sc.next());
		} {
			x[i]=Integer.parseInt(sc.next());
		} x[i]=Integer.parseInt(sc.next()) x[i] x i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int minimum =Integer.MAX_VALUE; minimum Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=1; i<=100; i++) {
			int total = 0;
			for(int aa:x) {
				total +=(aa-i) * (aa-i);
			}
			minimum = Math.min(total, minimum);
		} int i=1; int i=1; i 1 i<=100 i 100 i++ i++ i {
			int total = 0;
			for(int aa:x) {
				total +=(aa-i) * (aa-i);
			}
			minimum = Math.min(total, minimum);
		} {
			int total = 0;
			for(int aa:x) {
				total +=(aa-i) * (aa-i);
			}
			minimum = Math.min(total, minimum);
		} int total = 0; total 0 for(int aa:x) {
				total +=(aa-i) * (aa-i);
			} int aa x {
				total +=(aa-i) * (aa-i);
			} {
				total +=(aa-i) * (aa-i);
			} total +=(aa-i) * (aa-i) total (aa-i) * (aa-i) (aa-i) aa i (aa-i) aa i minimum = Math.min(total, minimum) minimum Math.min(total, minimum) Math.min Math total minimum System.out.println(minimum) System.out.println System.out System System.out minimum String[] args args
import java.util.Scanner;

class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N=Integer.parseInt(sc.next());
		int[] x = new int[N];
		for(int i=0; i<N; i++) {
			x[i]=Integer.parseInt(sc.next());
		}
		int minimum =Integer.MAX_VALUE;
		for(int i=1; i<=100; i++) {
			int total = 0;
			for(int aa:x) {
				total +=(aa-i) * (aa-i);
			}
			minimum = Math.min(total, minimum);
		}
		System.out.println(minimum);
	}
}
