function parseInput(input) {
  const values = []
  input.split('\n').forEach(row => {
    const list = row.split(' ')
    list.forEach(v => values.push(v))
  })

  return values
}

function getInput() {
  return parseInput(require('fs').readFileSync('/dev/stdin', 'utf8'))
}

function spend(Xi, P) {
  return Math.pow(Xi - P, 2)
}

;(function main() {
  const input = getInput()
  const N = +input[0]

  var min = Number.MAX_SAFE_INTEGER
  for (var p = 1; p <= 100; p++) {
    var s = 0
    for (var i = 1; i <= N; i++) {
      s += spend(+input[i], p)
    }

    if (min > s) {
      min = s
    }
  }

  console.log(min)
})()
