import java.util.*;
import java.lang.*;
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[] ans = new int[100];
		for( int k=1; k<=100; k++ ){
			for( int i=0; i<N; i++ ){
				ans[k-1] += (X[i]-k)*(X[i]-k);
			}
		}
		Arrays.sort(ans);
		System.out.println(ans[0]);      
	}
} import java.util.*; util.* java import java.lang.*; lang.* java 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[] ans = new int[100];
		for( int k=1; k<=100; k++ ){
			for( int i=0; i<N; i++ ){
				ans[k-1] += (X[i]-k)*(X[i]-k);
			}
		}
		Arrays.sort(ans);
		System.out.println(ans[0]);      
	}
} 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[] ans = new int[100];
		for( int k=1; k<=100; k++ ){
			for( int i=0; i<N; i++ ){
				ans[k-1] += (X[i]-k)*(X[i]-k);
			}
		}
		Arrays.sort(ans);
		System.out.println(ans[0]);      
	} 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[] ans = new int[100];
		for( int k=1; k<=100; k++ ){
			for( int i=0; i<N; i++ ){
				ans[k-1] += (X[i]-k)*(X[i]-k);
			}
		}
		Arrays.sort(ans);
		System.out.println(ans[0]);      
	} 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[] ans = new int[100]; ans new int[100] 100 for( int k=1; k<=100; k++ ){
			for( int i=0; i<N; i++ ){
				ans[k-1] += (X[i]-k)*(X[i]-k);
			}
		} int k=1; int k=1; k 1 k<=100 k 100 k++ k++ k {
			for( int i=0; i<N; i++ ){
				ans[k-1] += (X[i]-k)*(X[i]-k);
			}
		} {
			for( int i=0; i<N; i++ ){
				ans[k-1] += (X[i]-k)*(X[i]-k);
			}
		} for( int i=0; i<N; i++ ){
				ans[k-1] += (X[i]-k)*(X[i]-k);
			} int i=0; int i=0; i 0 i<N i N i++ i++ i {
				ans[k-1] += (X[i]-k)*(X[i]-k);
			} {
				ans[k-1] += (X[i]-k)*(X[i]-k);
			} ans[k-1] += (X[i]-k)*(X[i]-k) ans[k-1] ans k-1 k 1 (X[i]-k)*(X[i]-k) (X[i]-k) X[i] X i k (X[i]-k) X[i] X i k Arrays.sort(ans) Arrays.sort Arrays ans System.out.println(ans[0]) System.out.println System.out System System.out ans[0] ans 0 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[] ans = new int[100];
		for( int k=1; k<=100; k++ ){
			for( int i=0; i<N; i++ ){
				ans[k-1] += (X[i]-k)*(X[i]-k);
			}
		}
		Arrays.sort(ans);
		System.out.println(ans[0]);      
	}
} 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[] ans = new int[100];
		for( int k=1; k<=100; k++ ){
			for( int i=0; i<N; i++ ){
				ans[k-1] += (X[i]-k)*(X[i]-k);
			}
		}
		Arrays.sort(ans);
		System.out.println(ans[0]);      
	}
} Main
import java.util.*;
import java.lang.*;
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[] ans = new int[100];
		for( int k=1; k<=100; k++ ){
			for( int i=0; i<N; i++ ){
				ans[k-1] += (X[i]-k)*(X[i]-k);
			}
		}
		Arrays.sort(ans);
		System.out.println(ans[0]);      
	}
}