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