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];
			int min = 100;
			int max = 0;
			
			for(int i=0;i<n;i++) {
				x[i] = sc.nextInt();
				min = Math.min(min, x[i]);
				max = Math.max(max, x[i]);
			}
			
			int ret = Integer.MAX_VALUE;
			int reti = 0;
			
			for(int i=min;i<=max;i++) {
				reti = 0;
				for(int j=0;j<n;j++) {
					reti += Math.pow((x[j]-i), 2);
				}
				
				ret = Math.min(ret, reti);
			}
			
			System.out.println(ret);
		}
	} 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];
			int min = 100;
			int max = 0;
			
			for(int i=0;i<n;i++) {
				x[i] = sc.nextInt();
				min = Math.min(min, x[i]);
				max = Math.max(max, x[i]);
			}
			
			int ret = Integer.MAX_VALUE;
			int reti = 0;
			
			for(int i=min;i<=max;i++) {
				reti = 0;
				for(int j=0;j<n;j++) {
					reti += Math.pow((x[j]-i), 2);
				}
				
				ret = Math.min(ret, reti);
			}
			
			System.out.println(ret);
		}
	} Main public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
	        
			int n = sc.nextInt();
			int[] x = new int[n];
			int min = 100;
			int max = 0;
			
			for(int i=0;i<n;i++) {
				x[i] = sc.nextInt();
				min = Math.min(min, x[i]);
				max = Math.max(max, x[i]);
			}
			
			int ret = Integer.MAX_VALUE;
			int reti = 0;
			
			for(int i=min;i<=max;i++) {
				reti = 0;
				for(int j=0;j<n;j++) {
					reti += Math.pow((x[j]-i), 2);
				}
				
				ret = Math.min(ret, reti);
			}
			
			System.out.println(ret);
		} main {

			Scanner sc = new Scanner(System.in);
	        
			int n = sc.nextInt();
			int[] x = new int[n];
			int min = 100;
			int max = 0;
			
			for(int i=0;i<n;i++) {
				x[i] = sc.nextInt();
				min = Math.min(min, x[i]);
				max = Math.max(max, x[i]);
			}
			
			int ret = Integer.MAX_VALUE;
			int reti = 0;
			
			for(int i=min;i<=max;i++) {
				reti = 0;
				for(int j=0;j<n;j++) {
					reti += Math.pow((x[j]-i), 2);
				}
				
				ret = Math.min(ret, reti);
			}
			
			System.out.println(ret);
		} 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 int min = 100; min 100 int max = 0; max 0 for(int i=0;i<n;i++) {
				x[i] = sc.nextInt();
				min = Math.min(min, x[i]);
				max = Math.max(max, x[i]);
			} int i=0; int i=0; i 0 i<n i n i++ i++ i {
				x[i] = sc.nextInt();
				min = Math.min(min, x[i]);
				max = Math.max(max, x[i]);
			} {
				x[i] = sc.nextInt();
				min = Math.min(min, x[i]);
				max = Math.max(max, x[i]);
			} x[i] = sc.nextInt() x[i] x i sc.nextInt() sc.nextInt sc min = Math.min(min, x[i]) min Math.min(min, x[i]) Math.min Math min x[i] x i max = Math.max(max, x[i]) max Math.max(max, x[i]) Math.max Math max x[i] x i int ret = Integer.MAX_VALUE; ret Integer.MAX_VALUE Integer Integer.MAX_VALUE int reti = 0; reti 0 for(int i=min;i<=max;i++) {
				reti = 0;
				for(int j=0;j<n;j++) {
					reti += Math.pow((x[j]-i), 2);
				}
				
				ret = Math.min(ret, reti);
			} int i=min; int i=min; i min i<=max i max i++ i++ i {
				reti = 0;
				for(int j=0;j<n;j++) {
					reti += Math.pow((x[j]-i), 2);
				}
				
				ret = Math.min(ret, reti);
			} {
				reti = 0;
				for(int j=0;j<n;j++) {
					reti += Math.pow((x[j]-i), 2);
				}
				
				ret = Math.min(ret, reti);
			} reti = 0 reti 0 for(int j=0;j<n;j++) {
					reti += Math.pow((x[j]-i), 2);
				} int j=0; int j=0; j 0 j<n j n j++ j++ j {
					reti += Math.pow((x[j]-i), 2);
				} {
					reti += Math.pow((x[j]-i), 2);
				} reti += Math.pow((x[j]-i), 2) reti Math.pow((x[j]-i), 2) Math.pow Math (x[j]-i) x[j] x j i 2 ret = Math.min(ret, reti) ret Math.min(ret, reti) Math.min Math ret reti System.out.println(ret) System.out.println System.out System System.out ret 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];
			int min = 100;
			int max = 0;
			
			for(int i=0;i<n;i++) {
				x[i] = sc.nextInt();
				min = Math.min(min, x[i]);
				max = Math.max(max, x[i]);
			}
			
			int ret = Integer.MAX_VALUE;
			int reti = 0;
			
			for(int i=min;i<=max;i++) {
				reti = 0;
				for(int j=0;j<n;j++) {
					reti += Math.pow((x[j]-i), 2);
				}
				
				ret = Math.min(ret, reti);
			}
			
			System.out.println(ret);
		}
	} public class Main {
		
		

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
	        
			int n = sc.nextInt();
			int[] x = new int[n];
			int min = 100;
			int max = 0;
			
			for(int i=0;i<n;i++) {
				x[i] = sc.nextInt();
				min = Math.min(min, x[i]);
				max = Math.max(max, x[i]);
			}
			
			int ret = Integer.MAX_VALUE;
			int reti = 0;
			
			for(int i=min;i<=max;i++) {
				reti = 0;
				for(int j=0;j<n;j++) {
					reti += Math.pow((x[j]-i), 2);
				}
				
				ret = Math.min(ret, reti);
			}
			
			System.out.println(ret);
		}
	} 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];
			int min = 100;
			int max = 0;
			
			for(int i=0;i<n;i++) {
				x[i] = sc.nextInt();
				min = Math.min(min, x[i]);
				max = Math.max(max, x[i]);
			}
			
			int ret = Integer.MAX_VALUE;
			int reti = 0;
			
			for(int i=min;i<=max;i++) {
				reti = 0;
				for(int j=0;j<n;j++) {
					reti += Math.pow((x[j]-i), 2);
				}
				
				ret = Math.min(ret, reti);
			}
			
			System.out.println(ret);
		}
	}
