"use strict"
function consume(x, p){
  return Math.pow((x - p), 2);
}

function Main(input) {
  input = input.trim().split('\n');
  const N = Number(input[0]);
  const X = input[1].split(' ').map(Number);
  const M = X.length;

  let ret = [];
  for(let p=1; p<=101; p++){
    let tmp = 0;
    for(let i=0; i<M; i++){
      tmp += consume(X[i], p);
    }
    ret.push(tmp);
  }
  
  console.log(Math.min(...ret));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));