import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
		int n = kb.nextInt();
		int[] x = new int[n];
		for(int i = 0; i < n; i++) {
			x[i] = kb.nextInt();
		}
		
		
		int min = Integer.MAX_VALUE;
		for(int i = 0; i <= 100; i++) {
			int cost = 0;
			for(int j = 0; j < n; j++)
				cost += (x[j] - (i+1))*(x[j] - (i+1));
			min = Math.min(cost, min);
		}
		
		System.out.println(min);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
		int n = kb.nextInt();
		int[] x = new int[n];
		for(int i = 0; i < n; i++) {
			x[i] = kb.nextInt();
		}
		
		
		int min = Integer.MAX_VALUE;
		for(int i = 0; i <= 100; i++) {
			int cost = 0;
			for(int j = 0; j < n; j++)
				cost += (x[j] - (i+1))*(x[j] - (i+1));
			min = Math.min(cost, min);
		}
		
		System.out.println(min);
	}
} Main public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
		int n = kb.nextInt();
		int[] x = new int[n];
		for(int i = 0; i < n; i++) {
			x[i] = kb.nextInt();
		}
		
		
		int min = Integer.MAX_VALUE;
		for(int i = 0; i <= 100; i++) {
			int cost = 0;
			for(int j = 0; j < n; j++)
				cost += (x[j] - (i+1))*(x[j] - (i+1));
			min = Math.min(cost, min);
		}
		
		System.out.println(min);
	} main {
		Scanner kb = new Scanner(System.in);
		int n = kb.nextInt();
		int[] x = new int[n];
		for(int i = 0; i < n; i++) {
			x[i] = kb.nextInt();
		}
		
		
		int min = Integer.MAX_VALUE;
		for(int i = 0; i <= 100; i++) {
			int cost = 0;
			for(int j = 0; j < n; j++)
				cost += (x[j] - (i+1))*(x[j] - (i+1));
			min = Math.min(cost, min);
		}
		
		System.out.println(min);
	} Scanner kb = new Scanner(System.in); kb new Scanner(System.in) int n = kb.nextInt(); n kb.nextInt() kb.nextInt kb int[] x = new int[n]; x new int[n] n for(int i = 0; i < n; i++) {
			x[i] = kb.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			x[i] = kb.nextInt();
		} {
			x[i] = kb.nextInt();
		} x[i] = kb.nextInt() x[i] x i kb.nextInt() kb.nextInt kb int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0; i <= 100; i++) {
			int cost = 0;
			for(int j = 0; j < n; j++)
				cost += (x[j] - (i+1))*(x[j] - (i+1));
			min = Math.min(cost, min);
		} int i = 0; int i = 0; i 0 i <= 100 i 100 i++ i++ i {
			int cost = 0;
			for(int j = 0; j < n; j++)
				cost += (x[j] - (i+1))*(x[j] - (i+1));
			min = Math.min(cost, min);
		} {
			int cost = 0;
			for(int j = 0; j < n; j++)
				cost += (x[j] - (i+1))*(x[j] - (i+1));
			min = Math.min(cost, min);
		} int cost = 0; cost 0 for(int j = 0; j < n; j++)
				cost += (x[j] - (i+1))*(x[j] - (i+1)); int j = 0; int j = 0; j 0 j < n j n j++ j++ j cost += (x[j] - (i+1))*(x[j] - (i+1)); cost += (x[j] - (i+1))*(x[j] - (i+1)) cost (x[j] - (i+1))*(x[j] - (i+1)) (x[j] - (i+1)) x[j] x j (i+1) i 1 (x[j] - (i+1)) x[j] x j (i+1) i 1 min = Math.min(cost, min) min Math.min(cost, min) Math.min Math cost min System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {
	public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
		int n = kb.nextInt();
		int[] x = new int[n];
		for(int i = 0; i < n; i++) {
			x[i] = kb.nextInt();
		}
		
		
		int min = Integer.MAX_VALUE;
		for(int i = 0; i <= 100; i++) {
			int cost = 0;
			for(int j = 0; j < n; j++)
				cost += (x[j] - (i+1))*(x[j] - (i+1));
			min = Math.min(cost, min);
		}
		
		System.out.println(min);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
		int n = kb.nextInt();
		int[] x = new int[n];
		for(int i = 0; i < n; i++) {
			x[i] = kb.nextInt();
		}
		
		
		int min = Integer.MAX_VALUE;
		for(int i = 0; i <= 100; i++) {
			int cost = 0;
			for(int j = 0; j < n; j++)
				cost += (x[j] - (i+1))*(x[j] - (i+1));
			min = Math.min(cost, min);
		}
		
		System.out.println(min);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
		int n = kb.nextInt();
		int[] x = new int[n];
		for(int i = 0; i < n; i++) {
			x[i] = kb.nextInt();
		}
		
		
		int min = Integer.MAX_VALUE;
		for(int i = 0; i <= 100; i++) {
			int cost = 0;
			for(int j = 0; j < n; j++)
				cost += (x[j] - (i+1))*(x[j] - (i+1));
			min = Math.min(cost, min);
		}
		
		System.out.println(min);
	}
}
