import java.util.*;
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 = 100000000;
		for(int j=1;j<100;j++){
			int sum = 0;
			for(int t=0;t<n;t++){
				sum +=  (x[t] - j) * (x[t] - j);
				
			}
			if(sum < min){
				min = sum;
			}	
		 }

		 System.out.println(min);
		}
	} import java.util.*; util.* java 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 = 100000000;
		for(int j=1;j<100;j++){
			int sum = 0;
			for(int t=0;t<n;t++){
				sum +=  (x[t] - j) * (x[t] - j);
				
			}
			if(sum < min){
				min = sum;
			}	
		 }

		 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 = 100000000;
		for(int j=1;j<100;j++){
			int sum = 0;
			for(int t=0;t<n;t++){
				sum +=  (x[t] - j) * (x[t] - j);
				
			}
			if(sum < min){
				min = sum;
			}	
		 }

		 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 = 100000000;
		for(int j=1;j<100;j++){
			int sum = 0;
			for(int t=0;t<n;t++){
				sum +=  (x[t] - j) * (x[t] - j);
				
			}
			if(sum < min){
				min = sum;
			}	
		 }

		 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 = 100000000; min 100000000 for(int j=1;j<100;j++){
			int sum = 0;
			for(int t=0;t<n;t++){
				sum +=  (x[t] - j) * (x[t] - j);
				
			}
			if(sum < min){
				min = sum;
			}	
		 } int j=1; int j=1; j 1 j<100 j 100 j++ j++ j {
			int sum = 0;
			for(int t=0;t<n;t++){
				sum +=  (x[t] - j) * (x[t] - j);
				
			}
			if(sum < min){
				min = sum;
			}	
		 } {
			int sum = 0;
			for(int t=0;t<n;t++){
				sum +=  (x[t] - j) * (x[t] - j);
				
			}
			if(sum < min){
				min = sum;
			}	
		 } int sum = 0; sum 0 for(int t=0;t<n;t++){
				sum +=  (x[t] - j) * (x[t] - j);
				
			} int t=0; int t=0; t 0 t<n t n t++ t++ t {
				sum +=  (x[t] - j) * (x[t] - j);
				
			} {
				sum +=  (x[t] - j) * (x[t] - j);
				
			} sum +=  (x[t] - j) * (x[t] - j) sum (x[t] - j) * (x[t] - j) (x[t] - j) x[t] x t j (x[t] - j) x[t] x t j if(sum < min){
				min = sum;
			} sum < min sum min {
				min = sum;
			} min = sum min sum System.out.println(min) System.out.println System.out System System.out min String[] args args
import java.util.*;
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 = 100000000;
		for(int j=1;j<100;j++){
			int sum = 0;
			for(int t=0;t<n;t++){
				sum +=  (x[t] - j) * (x[t] - j);
				
			}
			if(sum < min){
				min = sum;
			}	
		 }

		 System.out.println(min);
		}
	}