import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int[]X = new int[N];
			int[]S = new int[N];
			for(int i=0;i<N;i++){
				X[i] = scan.nextInt();	
				S[i] = X[i];
			}
			//Pの範囲も１から１００まで
			Arrays.sort(S);
			int ps = S[0];
			int pf = S[N-1];
			
			ArrayList<Integer> minpower = new ArrayList<Integer>();
			
			for(int i = ps;i<=pf;i++) {
				int souwa=0;
				for(int j = 0;j<N;j++) {
					souwa+=(int)Math.pow(X[j]-i, 2);
				}
				minpower.add(souwa);
			}
			
			Collections.sort(minpower);
			
			
			
			System.out.println(minpower.get(0));

			
			
		}
		
		
	}
		

} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int[]X = new int[N];
			int[]S = new int[N];
			for(int i=0;i<N;i++){
				X[i] = scan.nextInt();	
				S[i] = X[i];
			}
			//Pの範囲も１から１００まで
			Arrays.sort(S);
			int ps = S[0];
			int pf = S[N-1];
			
			ArrayList<Integer> minpower = new ArrayList<Integer>();
			
			for(int i = ps;i<=pf;i++) {
				int souwa=0;
				for(int j = 0;j<N;j++) {
					souwa+=(int)Math.pow(X[j]-i, 2);
				}
				minpower.add(souwa);
			}
			
			Collections.sort(minpower);
			
			
			
			System.out.println(minpower.get(0));

			
			
		}
		
		
	}
		

} Main public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int[]X = new int[N];
			int[]S = new int[N];
			for(int i=0;i<N;i++){
				X[i] = scan.nextInt();	
				S[i] = X[i];
			}
			//Pの範囲も１から１００まで
			Arrays.sort(S);
			int ps = S[0];
			int pf = S[N-1];
			
			ArrayList<Integer> minpower = new ArrayList<Integer>();
			
			for(int i = ps;i<=pf;i++) {
				int souwa=0;
				for(int j = 0;j<N;j++) {
					souwa+=(int)Math.pow(X[j]-i, 2);
				}
				minpower.add(souwa);
			}
			
			Collections.sort(minpower);
			
			
			
			System.out.println(minpower.get(0));

			
			
		}
		
		
	} main {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int[]X = new int[N];
			int[]S = new int[N];
			for(int i=0;i<N;i++){
				X[i] = scan.nextInt();	
				S[i] = X[i];
			}
			//Pの範囲も１から１００まで
			Arrays.sort(S);
			int ps = S[0];
			int pf = S[N-1];
			
			ArrayList<Integer> minpower = new ArrayList<Integer>();
			
			for(int i = ps;i<=pf;i++) {
				int souwa=0;
				for(int j = 0;j<N;j++) {
					souwa+=(int)Math.pow(X[j]-i, 2);
				}
				minpower.add(souwa);
			}
			
			Collections.sort(minpower);
			
			
			
			System.out.println(minpower.get(0));

			
			
		}
		
		
	} try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int[]X = new int[N];
			int[]S = new int[N];
			for(int i=0;i<N;i++){
				X[i] = scan.nextInt();	
				S[i] = X[i];
			}
			//Pの範囲も１から１００まで
			Arrays.sort(S);
			int ps = S[0];
			int pf = S[N-1];
			
			ArrayList<Integer> minpower = new ArrayList<Integer>();
			
			for(int i = ps;i<=pf;i++) {
				int souwa=0;
				for(int j = 0;j<N;j++) {
					souwa+=(int)Math.pow(X[j]-i, 2);
				}
				minpower.add(souwa);
			}
			
			Collections.sort(minpower);
			
			
			
			System.out.println(minpower.get(0));

			
			
		} {
			int N = scan.nextInt();
			int[]X = new int[N];
			int[]S = new int[N];
			for(int i=0;i<N;i++){
				X[i] = scan.nextInt();	
				S[i] = X[i];
			}
			//Pの範囲も１から１００まで
			Arrays.sort(S);
			int ps = S[0];
			int pf = S[N-1];
			
			ArrayList<Integer> minpower = new ArrayList<Integer>();
			
			for(int i = ps;i<=pf;i++) {
				int souwa=0;
				for(int j = 0;j<N;j++) {
					souwa+=(int)Math.pow(X[j]-i, 2);
				}
				minpower.add(souwa);
			}
			
			Collections.sort(minpower);
			
			
			
			System.out.println(minpower.get(0));

			
			
		} Scanner scan = new Scanner(System.in) Scanner scan = new Scanner(System.in) new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int[]X = new int[N]; X new int[N] N int[]S = new int[N]; S new int[N] N for(int i=0;i<N;i++){
				X[i] = scan.nextInt();	
				S[i] = X[i];
			} int i=0; int i=0; i 0 i<N i N i++ i++ i {
				X[i] = scan.nextInt();	
				S[i] = X[i];
			} {
				X[i] = scan.nextInt();	
				S[i] = X[i];
			} X[i] = scan.nextInt() X[i] X i scan.nextInt() scan.nextInt scan S[i] = X[i] S[i] S i X[i] X i Arrays.sort(S) Arrays.sort Arrays S int ps = S[0]; ps S[0] S 0 int pf = S[N-1]; pf S[N-1] S N-1 N 1 ArrayList<Integer> minpower = new ArrayList<Integer>(); minpower new ArrayList<Integer>() for(int i = ps;i<=pf;i++) {
				int souwa=0;
				for(int j = 0;j<N;j++) {
					souwa+=(int)Math.pow(X[j]-i, 2);
				}
				minpower.add(souwa);
			} int i = ps; int i = ps; i ps i<=pf i pf i++ i++ i {
				int souwa=0;
				for(int j = 0;j<N;j++) {
					souwa+=(int)Math.pow(X[j]-i, 2);
				}
				minpower.add(souwa);
			} {
				int souwa=0;
				for(int j = 0;j<N;j++) {
					souwa+=(int)Math.pow(X[j]-i, 2);
				}
				minpower.add(souwa);
			} int souwa=0; souwa 0 for(int j = 0;j<N;j++) {
					souwa+=(int)Math.pow(X[j]-i, 2);
				} int j = 0; int j = 0; j 0 j<N j N j++ j++ j {
					souwa+=(int)Math.pow(X[j]-i, 2);
				} {
					souwa+=(int)Math.pow(X[j]-i, 2);
				} souwa+=(int)Math.pow(X[j]-i, 2) souwa (int)Math.pow(X[j]-i, 2) Math.pow Math X[j]-i X[j] X j i 2 minpower.add(souwa) minpower.add minpower souwa Collections.sort(minpower) Collections.sort Collections minpower System.out.println(minpower.get(0)) System.out.println System.out System System.out minpower.get(0) minpower.get minpower 0 String[]args args public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int[]X = new int[N];
			int[]S = new int[N];
			for(int i=0;i<N;i++){
				X[i] = scan.nextInt();	
				S[i] = X[i];
			}
			//Pの範囲も１から１００まで
			Arrays.sort(S);
			int ps = S[0];
			int pf = S[N-1];
			
			ArrayList<Integer> minpower = new ArrayList<Integer>();
			
			for(int i = ps;i<=pf;i++) {
				int souwa=0;
				for(int j = 0;j<N;j++) {
					souwa+=(int)Math.pow(X[j]-i, 2);
				}
				minpower.add(souwa);
			}
			
			Collections.sort(minpower);
			
			
			
			System.out.println(minpower.get(0));

			
			
		}
		
		
	}
		

} public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int[]X = new int[N];
			int[]S = new int[N];
			for(int i=0;i<N;i++){
				X[i] = scan.nextInt();	
				S[i] = X[i];
			}
			//Pの範囲も１から１００まで
			Arrays.sort(S);
			int ps = S[0];
			int pf = S[N-1];
			
			ArrayList<Integer> minpower = new ArrayList<Integer>();
			
			for(int i = ps;i<=pf;i++) {
				int souwa=0;
				for(int j = 0;j<N;j++) {
					souwa+=(int)Math.pow(X[j]-i, 2);
				}
				minpower.add(souwa);
			}
			
			Collections.sort(minpower);
			
			
			
			System.out.println(minpower.get(0));

			
			
		}
		
		
	}
		

} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			int[]X = new int[N];
			int[]S = new int[N];
			for(int i=0;i<N;i++){
				X[i] = scan.nextInt();	
				S[i] = X[i];
			}
			//Pの範囲も１から１００まで
			Arrays.sort(S);
			int ps = S[0];
			int pf = S[N-1];
			
			ArrayList<Integer> minpower = new ArrayList<Integer>();
			
			for(int i = ps;i<=pf;i++) {
				int souwa=0;
				for(int j = 0;j<N;j++) {
					souwa+=(int)Math.pow(X[j]-i, 2);
				}
				minpower.add(souwa);
			}
			
			Collections.sort(minpower);
			
			
			
			System.out.println(minpower.get(0));

			
			
		}
		
		
	}
		

}
