function Main(input) {
	input = input.split("\n");
	var tmp = input[1].split(" ");
	var n = parseInt(input[0], 10);
	var ns = new Array(n);
	var min = 100000000;
	for(var k=0; k<=100; k++){
    	var sum = 0;
    	for(var i=0; i<n; i++){
    		ns[i] = parseInt(tmp[i], 10);
        	sum += Math.pow(ns[i] - k, 2);
        }
      if(min > sum){
        min = sum;
      }
    }
	console.log(min);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));