function Main(input) {
	var input = input.split("\n");
	var N = parseInt(input[0]);
	var X = input[1].split(" ").sort((a, b) => {
		return a - b;
	});

	var sum = 0;
	for(var i = 0; i < N; i++) {
		sum += parseInt(X[i]);
	}
	var p = parseInt(sum / N + 0.9);

	var hp = 0;
	for(var i = 0; i < N; i++) {
		hp += Math.pow((X[i] - p), 2);
	}
	console.log(hp);


}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));