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];
		long ans=Long.MAX_VALUE;
		
		for (int i=0; i<N; i++) {
			X[i] = sc.nextInt();
		}
		
		for (int i=1; i<101; i++) {
			long min = 0;
			
			for (int j=0; j<N; j++) {
				min += (X[j]-i)*(X[j]-i);
			}
			ans = Math.min(ans, min);
		}
		System.out.println(ans);
	}
} 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];
		long ans=Long.MAX_VALUE;
		
		for (int i=0; i<N; i++) {
			X[i] = sc.nextInt();
		}
		
		for (int i=1; i<101; i++) {
			long min = 0;
			
			for (int j=0; j<N; j++) {
				min += (X[j]-i)*(X[j]-i);
			}
			ans = Math.min(ans, min);
		}
		System.out.println(ans);
	}
} Main public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		long ans=Long.MAX_VALUE;
		
		for (int i=0; i<N; i++) {
			X[i] = sc.nextInt();
		}
		
		for (int i=1; i<101; i++) {
			long min = 0;
			
			for (int j=0; j<N; j++) {
				min += (X[j]-i)*(X[j]-i);
			}
			ans = Math.min(ans, min);
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] X = new int[N];
		long ans=Long.MAX_VALUE;
		
		for (int i=0; i<N; i++) {
			X[i] = sc.nextInt();
		}
		
		for (int i=1; i<101; i++) {
			long min = 0;
			
			for (int j=0; j<N; j++) {
				min += (X[j]-i)*(X[j]-i);
			}
			ans = Math.min(ans, min);
		}
		System.out.println(ans);
	} 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 long ans=Long.MAX_VALUE; ans Long.MAX_VALUE Long Long.MAX_VALUE 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 for (int i=1; i<101; i++) {
			long min = 0;
			
			for (int j=0; j<N; j++) {
				min += (X[j]-i)*(X[j]-i);
			}
			ans = Math.min(ans, min);
		} int i=1; int i=1; i 1 i<101 i 101 i++ i++ i {
			long min = 0;
			
			for (int j=0; j<N; j++) {
				min += (X[j]-i)*(X[j]-i);
			}
			ans = Math.min(ans, min);
		} {
			long min = 0;
			
			for (int j=0; j<N; j++) {
				min += (X[j]-i)*(X[j]-i);
			}
			ans = Math.min(ans, min);
		} long min = 0; min 0 for (int j=0; j<N; j++) {
				min += (X[j]-i)*(X[j]-i);
			} int j=0; int j=0; j 0 j<N j N j++ j++ j {
				min += (X[j]-i)*(X[j]-i);
			} {
				min += (X[j]-i)*(X[j]-i);
			} min += (X[j]-i)*(X[j]-i) min (X[j]-i)*(X[j]-i) (X[j]-i) X[j] X j i (X[j]-i) X[j] X j i ans = Math.min(ans, min) ans Math.min(ans, min) Math.min Math ans min System.out.println(ans) System.out.println System.out System System.out ans 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];
		long ans=Long.MAX_VALUE;
		
		for (int i=0; i<N; i++) {
			X[i] = sc.nextInt();
		}
		
		for (int i=1; i<101; i++) {
			long min = 0;
			
			for (int j=0; j<N; j++) {
				min += (X[j]-i)*(X[j]-i);
			}
			ans = Math.min(ans, min);
		}
		System.out.println(ans);
	}
}