"use strict";
function main(input) {
  let n = parseInt(input[0]);
  let x = input[1].trim().split(" ");
  
  for(let i=0;i<x.length;i++){
    x[i] = parseInt(x[i]);
  }
  
  x.sort(function(a, b) {
    return b - a;
  });

  let sum = [];

  for(let i=1;i<x[0];i++){
    sum[i-1] = 0;
    for(let j=0;j<x.length;j++){
      sum[i-1] += Math.pow((i - x[j]),2);
    } 
  }

  console.log(Math.min(...sum));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));