import scala.math.pow

object Main extends App {

  val sc = new java.util.Scanner(System.in)
  sc.useDelimiter("\n")
  val N = sc.nextInt()
  val X = sc.next().split(' ').map(_.toInt).toList
  val max = X.max
  val results = for (i <- 1 to max) yield {
    X.map(n => pow(i - n, 2).toInt).sum
  }
  println(results.min)
}